历史版本。 PostgreSQL 7.1 已结束支持。 请参阅 当前版本手册.
4.3. 认证问题 #
真正的认证失败及相关问题通常会表现为类似下面这样的错误消息。
No pg_hba.conf entry for host 123.123.123.123, user joeblow, database testdb
如果你成功联系到了服务器、但服务器不想与你交谈,最可能得到的就是这个。正如消息所示,服务器拒绝了该连接请求,因为它没有在自己的
pg_hba.conf 配置文件中找到授权条目。
Password authentication failed for user 'joeblow'
这样的消息表示你已经联系到了服务器,而且服务器也愿意与你交谈,但前提是你必须先通过
pg_hba.conf 文件中指定的认证方法。请检查你提供的密码;如果错误消息提到了
Kerberos 或 IDENT
等认证类型,也请检查对应的软件。
FATAL 1: user "joeblow" does not exist
指定的用户名在 pg_shadow 中未找到。
FATAL 1: Database "testdb" does not exist in the system catalog.
你试图连接的数据库不存在。注意,如果你不指定数据库名,默认会使用数据库用户名作为数据库名,但这不一定是对的。