建立遠程訪問用戶,注意用戶名若要作到大小寫敏感須要額外操做,建議全小寫sql
sudo -u postgres createuser --interactive
更改密碼bash
sudo -u postgres psql \password ${username}
確認端口post
sudo netstat -plunt | grep postgres
切換目錄rest
cd /etc/postgresql/9.6/main
編輯文件postgresql.conf
,使得listen_addresses = '*'
;編輯文件pg_hba.conf
,在文件中(通常在末尾)增長host all {username} 0.0.0.0/0 md5
postgresql
從新啓動服務code
sudo service postgresql restart
便可使用pgAdmin等嘗試鏈接md5