Monday, April 15, 2019

psql: FATAL: Ident authentication failed for user “postgres”

Symptom:

psql connect to postgresql server, get below error:
psql: FATAL: Ident authentication failed for user “postgres”

Solution:

By default , the authentication in pg_hba.conf is "ident"
We need to replace it with "md5" to use password. After that reload postgres

example to allow apps connections and trust local connections :
# "local" is for Unix domain socket connections only
local   all             all                                         trust
# IPv4 local connections:
host    all             all             127.0.0.1/32        trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                             trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                     trust
host    all                  all             0.0.0.0/0                  md5

No comments:

Post a Comment