- vim /etc/postgresql/9.6/main/postgresql.conf
大约 57 行
修改listen_addresses="*"
如果需要更改端口 port=5432
- vim /etc/postgresql/9.6/main/pg_hba.conf
Ctrl+g 至文件最后
添加允许连接 主机 IP 地址
0.0.0.0/0 表示所有连接
host all all <ip>/<mask> md5
- 重启服务配置
/etc/init.d/postgresql reload