2013-08-01 63 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获取相关文档,这进一步详细说明。 –