假设你看到这个消息:
FATAL: Ident authentication failed for user "..."
这个错误信息的原因是什么?
这意味着Postgres正在尝试使用Ident协议来validation用户,而不能。 Ident auth的工作原理是这样的:
pg_hba.conf文件(在/etc/postgres-something/main )将“Ident”定义为连接到数据库db的协议,以便从特定主机 可能的原因和解决办法
sudo apt-get install oidentd )。 CREATE ROLE foo 。 或者,添加一个条目到/etc/postgresql/.../main/pg_ident.conf 。 也许你实际上想要连接一个密码 ,而不是Ident。 编辑适当的pg_hba.conf文件。 例如,更改:
host all all 127.0.0.1/32 ident
至
host all all 127.0.0.1/32 md5
不知道的原因,但这固定了我:
在pg_hba.conf
改为:
主机全部都是127.0.0.1/32 md5
确切的错误: Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "postgres"
在CentOS上, /var/lib/pgsql/9.3/data/pg_hba.conf下行添加到/var/lib/pgsql/9.3/data/pg_hba.conf :
host all all 127.0.0.1/32 trust
并注释掉其他条目。
当然,这个设置是不安全的,但是如果你只是在像我这样的开发虚拟机上搞乱,那么可能是好的…
如果您还没有尝试过,请查看您的pg_hba.conf文件。 它会被命名为/var/lib/pgsql/9.3/data/pg_hba.conf(Fedora 20)。 你可能不得不使用'find / -name pg_hba.conf'来find它。
在文件底部,将“方法”值更改为“信任”以进行本地testing(有关完整信息,请参阅postgres文档)。 重新启动机器,以确保一切都开始干净,新的参数被读取。
希望这会治愈你的困境。 它用PostgreSQL 9.3解决了我在Fedora 20上遇到的问题。