postgresql-宝塔 --- no pg_hba.conf entry for host

323 阅读1分钟

这条错误的原因是因为客户端远程访问postgresql受限所致,因为postgresql默认情况下除本机外的机器是不能连接的。

  • 认证文件 pg_hba.conf

pg_hba.conf每条记录声明一种联接类型,一个客户端 IP 地址范围(如果和联接类型相关的话),一个数据库名,一个用户名字,以及对匹配这些参数的联接使用的认证方法。

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             0.0.0.0/0               md5 //新加使所有ip均可访问

重启即可