1. 查找配置文件
# find / -name pg_hba.conf # find / -name postgresql.conf
2.修改
2.1 修改pg_hba.conf
查找IPv4 local connections
修改默認的
host all all 127.0.0.1/32 trust
為
host all all 192.168.1.1/32 trust #IP全匹配 或 host all all 192.168.1.1/24 trust #IP匹配前三段 或 host all all 0.0.0.0/0 trust #全部允許
2.2 修改postgresql.conf
查找 Connection Settings
修改默認的
listen_addresses = 'localhost'
為
listen_addresses = '*'
重啟postgresql服務
End.