postgre基本用法(一)

1、啓動postgre

service postgresql start

2、#以postgres用戶登錄

su - postgres
psql 
\l 查看當前的數據庫列表
\d 當前數據庫下的所有表
\q 退出

3、#以git用戶登錄

su - git

4、

psql -d gitlabhq_production -U git -p 5432

./bin/psql -h 127.0.0.1 -d postgres -U postgres -p 5432

其中-h參數指定服務器地址,默認爲127.0.0.1,默認不指定即可,-d指定連接之後選中的數據庫,默認也是postgres,-U指定用戶,默認是當前用戶,-p 指定端口號,默認是"5432",其它更多的參數選項可

發佈了56 篇原創文章 · 獲贊 8 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章