2013-08-01 62 views
1

你好,我是一個初學者postgresql,我無法通過pgadmin客戶端連接Linux系統上的Postgresql數據庫。我收到以下錯誤PostgreSQL數據庫連接錯誤

FATAL: no pg_hba.conf entry for host "192.168.1.42", user "postgres", database "postgres", SSL off 

請建議我如何提前do.Thanks

回答

5

在數據庫服務器,編輯pg_hba.conf文件並添加類似這樣一行:

host all    all    192.168.1.42/32   md5 

如果您不想使用密碼(我不會涉及安全問題),您可以將「md5」切換爲「信任」。如果你只有想要允許postgres用戶訪問postgres維護數據庫,然後用「postgres」(不包括引號)切換「所有」單詞。

您需要在進行任何更改後重新加載配置文件。例如,

pg_ctl reload 

select pg_reload_conf(); -- as the superuser 

如果你不知道哪個pg_hba.conf文件數據庫羣集使用的,如果你可以連接到任何數據庫,問題select current_setting('hba_file');

+1

請訪問http: //www.postgresql.org/docs/current/static/client-authentication.html和http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html獲取相關文檔,這進一步詳細說明。 –