PostgreSQL命令

启动和停止PostgreSQL

查询PostgreSQL版本
$ postgres –version

初始化:
$ initdb /usr/local/var/postgres -E utf8

启动数据库服务器
$ pg_ctl start -D /usr/local/var/postgres

停止数据库服务器。
$ pg_ctl stop -D /usr/local/var/postgres

连接到PostgreSQL

连接到默认的数据库表
psql -d postgres

指定数据表和用户进行连接
psql -d 数据表名称 -U 用户名称

断开连接

数据库

数据库列表

选择数据库;
\c 数据库名称;

桌子

显示表格列表(包括序列)。

展示表格列表(仅显示表格)

显示表格结构
\d 表名

修改表的所有者。
将表名的所有者更改为所有者名。

用户

用户列表

筹划模式

数据库架构列表

广告
将在 10 秒后关闭
bannerAds