** OS系統:
本機只能用 postgres 這個user,來操作 postgresql
#sudo -s
#su postgres
進入 postgresql 的指令:psql
#psql
** psql 執行後,可操作的指令:
查看目前的資料庫:\l
查看目前的tablespace:\db
查看目前的使用者:\du
查看目前的群組:\dg
離開postgresql:\q
** 開啟 postgresql 遠端連線:
設定檔位置: /etc/postgresql/9.1/main/
1.修改pg_hba.conf
host all all 192.168.0.0/16 md5
參數1:host表遠端存取,local表本機端存取
參數2:設定可存取的Database
參數3:設定可存取的使用者
參數4:設定可存取之網域
參數5:trust表不需認證,md5表示需要md5密碼
2.修改postgresql.conf
取消註解,並設定為 listen_addresses ='*'
取消註解,並設定為 port=5432
3.重新啟動資料庫
service postgresql restart
0 意見:
張貼留言