我在Debian Squeeze服务器上运行PostgreSQL 9.1.9(使用backports)。 pg_hba.conf文件的内容是:
local all postgres trust # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 host all all 192.168.1.237/32 md5
我已经为postgres用户设置了密码:
alter user postgres with password 'pass';
我尝试从PgAdminbuild立连接,但是我无法使其工作。 它一直抛出authentication失败的错误。 我的客户端是上面的文件中显示的IP 192.168.1.237 。 如果我更改身份validation方法信任和重新加载postgresql,我连接就好了。 服务器日志中的错误是:
FATAL: password authentication failed for user "postgres"
我的服务器configuration有什么问题?
既然你提到了pgAdmin,如果你用它来修改postgres帐户,你可能会遭受dba.se中提到的密码到期date错误 :
PostgreSQL用户在更改密码后无法连接到服务器
基本上,解决方法是:
ALTER USER postgres VALID UNTIL 'infinity';