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",其它更多的參數選項可