 |
$ sudo su postgres 切换到postgres用户 postgres@phpServer:/home/octopus$ createdb mydb 创建数据库mydb postgres@phpServer:/home/octopus$ psql mydb 打开psql命令行
|
 |
\l 查看所有数据库 \dt 查看当前数据库中的所有数据表 \d 表名 查看某个表的结构
|
 |
输入\l后可以输入\q退出
|
 |
mydb=# \dt 关联列表 架构模式 | 名称 | 型别 | 拥有者 ----------+----------+--------+---------- public | cities | 资料表 | postgres public | products | 资料表 | postgres public | weather | 资料表 | postgres (3 行记录)
mydb=# \d weather 资料表 "public.weather" 栏位 | 型别 | 修饰词 ---------+-----------------------+-------- city | character varying(80) | temp_lo | integer | temp_hi | integer | prcp | real | date | date |
|