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


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM