 |
$ 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 |
|