I know this question has been asked several times before, but all answers I could find tell you to add a line like the following to the pg_hba.conf
file:
host all all 127.0.0.1/32 md5
So my pg_hba.conf
file now looks like this:
# 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
I have set up several postgresql servers in the past on ubuntu and never had a problem. However, on fedora, I still get the following error message:
FATAL: Ident authentication failed for user "postgres"
The server is running on Fedora 27 Workstation and the postgresql version is 9.6.8-1.fc27.
You have two authentication rules for localhost in your
pg_hba.conf
, namely ..and
I believe the system is trying to validate the two authentication options, making the
trust
option being overwritten byident
. Since you're most likely trying to usetrust
to authenticate from localhost (based on your file), just comment/delete the following line:And afterwards either restart your database or reload the conf file using the following query: