加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL 连接问题 FATAL: no pg_hba.conf entry for host

发布时间:2020-12-13 17:32:48 所属栏目:百科 来源:网络整理
导读:The server doesn't grant access to the database: the server reports FATAL: no pg_hba.conf entry for host "192.168.0.123",user "postgres",database "postgres" FATAL: no pg_hba.conf entry for host "192.168.0.123",database "postgres" PostgreSQ

The server doesn't grant access to the database: the server reports
FATAL: no pg_hba.conf entry for host "192.168.0.123",user "postgres",database "postgres" FATAL: no pg_hba.conf entry for host "192.168.0.123",database "postgres"


PostgreSQL数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常:

org.postgresql.util.PSQLException: FATAL:nopg_hba.confentryforhost

要解决这个问题,只需要在PostgreSQL数据库的安装目录下找到/data/pg_hba.conf,找到“# IPv4 local connections:”

在其下加上请求连接的机器IP

hostall all 127.0.0.1/32 md5

32是子网掩码的网段;md5是密码验证方法,可以改为trust

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读