Ubuntu 16.04 安裝使用PostgreSQL最佳指南

一、安裝

apt install postgresql

二、編輯 /etc/postgresql/9.5/main/postgresql.conf

將下面 listen_addresses = 'localhost'注釋去掉并改為  listen_addresses = '*'
# - Connection Settings -
#listen_addresses = 'localhost'          
# what IP address(es) to listen on;                
# comma-separated list of addresses;     
# defaults to 'localhost'; use '*' for all
...

將下面password_encryption = on 注釋打開
#password_encryption = on

三、切換用戶su - postgres
四、通過 psql 命令進入postgresql客戶端
五、修改用戶密碼:

 ALTER USER postgres PASSWORD '123456';

六、 vim /etc/postgresql/9.5/main/pg_hba.conf 修改 host all all 192.168.1.0/24 md5 中的ip,為:0.0.0.0/0

# TYPE DATABASE  USER    CIDR-ADDRESS     METHOD
# "local" is for Unix domain socket connections only
local all    all               trust
# IPv4 local connections:
host  all    all    127.0.0.1/32     trust
host  all    all    192.168.1.0/24    md5
# IPv6 local connections:
host  all    all    ::1/128       trust
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容