我知道这个问题之前已经被问过好几次了,但我能找到的所有答案都告诉你在pg_hba.conf
文件中添加如下一行:
host all all 127.0.0.1/32 md5
所以我的pg_hba.conf
文件现在看起来像这样:
# 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 ident
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
# I've added the following lines:
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 192.168.0.0/24 md5
我过去在 ubuntu 上设置了几个 postgresql 服务器,从来没有遇到过问题。但是,在 Fedora 上,我仍然收到以下错误消息:
FATAL: Ident authentication failed for user "postgres"
服务器在 Fedora 27 Workstation 上运行,postgresql 版本为9.6.8-1.fc27。