Back

postgres - 允许外网访问

发布时间: 2019-04-12 08:28:00

参考:https://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg-hba-conf-entry-for-host?newreg=86fd63ce2427420dbc57e0e4166cd3f1

写的很明白了。

修改 pg_hba.conf 文件:

host    all             all             127.0.0.1/32          trust    
host    all             all             172.0.0.0/8            trust    # 允许 172.x.x.x 访问
host    all             all             0.0.0.0/0               trust     #允许所有ip访问。 建议这里使用md5 , trust会不校验密码

修改 postgresql.conf

listen_addresses = '*'

然后重新启动即可。

pg_ctl restart

Back