在ubuntu中收到此错误消息。在pg_hba.conf文件中,我尝试在不同的时间使用'ident','peer','trust','md5'。但是没有去。请帮忙。
在你的pg_hba.conf中
# IPv4 local connections:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 127.0.0.1/32 trust
如果它不起作用然后尝试
host all all your_ip/32 trust
然后重启你的数据库它会正常工作
如果用户名和密码正确,那么md5
是正确的值。确保重新启动数据库进程或至少在修改pg_hba.conf
后重新加载配置。
它可能来自恶意流量,检查日志是否几乎每秒重复一次,如下所示
2019-04-17 16:10:39.228 UTC [32] FATAL:
password authentication failed for user "postgres"
2019-04-17 16:10:39.228 UTC [32] DETAIL:
Connection matched pg_hba.conf line 95: "host all all all md5"
2019-04-17 16:10:41.916 UTC [33] FATAL:
password authentication failed for user "postgres"
2019-04-17 16:10:41.916 UTC [33] DETAIL:
Connection matched pg_hba.conf line 95: "host all all all md5"
...
...
让我们使用tcpdump命令验证端口5432上的TCP流量
$ sudo tcpdump port 5432 and '(tcp-syn|tcp-ack)!=0'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes
16:19:26.472838 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [S], seq 1779566115, win 29200, options [mss 1380,sackOK,TS val 451453976 ecr 0,nop,wscale 7], length 0
16:19:26.473135 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903: Flags [S.], seq 4028889669, ack 1779566116, win 28960, options [mss 1460,sackOK,TS val 2412144 ecr 451453976,nop,wscale 7], length 0
16:19:26.525816 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [.], ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 0
16:19:26.525875 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net: Flags [P.], seq 1:42, ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 41
...
...
如果是这种情况,那么设置firewall rules和必要的证券来打击机器人或不需要的流量。
我注意到我创建的用户的截止日期是昨天。它还给了我密码错误。我打开了pgadmin3,在底部的用户列表中,我已经更改了有问题的用户的截止日期。