Symptoms

The below error is reported during the DS-NOC installation to use Postgres DB on RHEL.

0. FATAL: password authentication failed for user postgres

1. Failed to connect to the database. Trying to connect to template1 and create it.

2. FATAL: password authentication failed for user postgres


Cause

Either the postgres password was not set or is incorrect or remote host was not allowed to connect to the postgres db instance.


Workaround

a) Set a password for the postgres user: $ sudo passwd postgres

b) Alter the password if incorrect,: $ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"

c) Try to change md5 to trust in (pg_hba.conf) for all remote connections and check.

# TYPE DATABASE USER ADDRESS METHOD

#local is for Unix domain socket connections only

local all all trust

# IPv4 local connections:

host all all 127.0.0.1/32 md5


local all all trust # IPv4 local connections: host all all 127.0.0.1/32 md5