PostgreSQL数据库连接错误

sha*_*ank 1 postgresql postgresql-9.1

你好我是postgresql的初学者,我无法通过pgadmin客户端从windows连接linux系统上的Postgresql数据库.我收到以下错误

FATAL: no pg_hba.conf entry for host "192.168.1.42", user "postgres", database "postgres", SSL off 
Run Code Online (Sandbox Code Playgroud)

请建议我怎么做.谢谢

bma*_*bma 6

在db服务器上,编辑pg_hba.conf文件并添加与此类似的行:

host    all             all             192.168.1.42/32            md5
Run Code Online (Sandbox Code Playgroud)

如果您不想使用密码(我不会涉及安全方面),您可以将"md5"切换为"trust".如果你希望允许Postgres的维护数据库的postgres用户访问,然后用"的Postgres"(不含引号)开关兼备"全"字.

您需要在进行任何更改后重新加载配置文件.例如.

pg_ctl reload
Run Code Online (Sandbox Code Playgroud)

要么

select pg_reload_conf(); -- as the superuser
Run Code Online (Sandbox Code Playgroud)

如果您不知道数据库集群正在使用哪个pg_hba.conf文件,那么如果您可以连接到任何数据库,请发出 select current_setting('hba_file');