【发布时间】:2018-04-30 10:32:57
【问题描述】:
我知道这个问题之前已经被问过好几次了,但我能找到的所有答案都告诉你在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。
【问题讨论】:
-
嘿,你重新加载了conf文件吗?
select pg_reload_conf();我的意思是,如果你负担不起重启数据库系统的费用。 -
@JimJones 我做了几次
systemctl restart postgresql -
只是为了测试,如果你把
ident改成trust,你能成功连接吗? -
只评论那一行
host all all 127.0.0.1/32 ident并保持原样host all all 127.0.0.1/32 trust -
@JimJones 谢谢!这似乎是诀窍。为什么我不能同时启用
ident和trust?
标签: postgresql fedora postgresql-9.6 fedora-27