1. 程式人生 > >PostgreSQL 連接問題 FATAL: no pg_hba.conf entry for host

PostgreSQL 連接問題 FATAL: no pg_hba.conf entry for host

port lac 掩碼 ext pos word 數據庫的安裝 conn targe

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", user "postgres", database "postgres"

PostgreSQL數據庫為了安全,它不會監聽除本地以外的所有連接請求,當用戶通過JDBC訪問是,會報一些如下的異常:

org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host

要解決這個問題,只需要在PostgreSQL數據庫的安裝目錄下找到/data/pg_hba.conf,找到“# IPv4 local connections:”

在其下加上請求連接的機器IP

host all all 127.0.0.1/32 md5

32是子網掩碼的網段;md5是密碼驗證方法,可以改為trust

PostgreSQL 連接問題 FATAL: no pg_hba.conf entry for host