How to Resolve Password Authentication Failed Errors in PostgreSQL®
Overview
If your server returns a Password authentication failed for user error when you try to access MySQL® resources, the most likely culprit is an invalid or missing PostgreSQL® user password.
Solution
Check the /root/.pgpass
password file to confirm that the password exists in ::*:postgres:PASSWORD
format.
If the password does not exist, you must edit the /var/lib/pgsql/data/pg_hba.conf
file directly. To do this:
-
Stop Tailwatch. To do this, run the following commands:
1 2
touch /etc/tailwatchddisable killall tailwatchd
-
Edit the
/var/lib/pgsql/data/pg_hba.conf
file and change themd5
value to thetrust
value. -
Restart PostgreSQL. To do this, run the
/usr/local/cpanel/scripts/restartsrv_postgresql
command. -
Change the PostgreSQL password. To do this, run the following command, where
new_pass
represents the new password:postgres=# alter user postgres with encrypted password =new_pass postgres=# q
-
Edit the
/var/lib/pgsql/data/pg_hba.conf
file and change thetrust
value to themd5
value. -
Remove the Tailwatch touch file and restart the service. To do this, run the following commands:
1 2
rm /etc/tailwatchddisable /usr/local/cpanel/scripts/restartsrv_tailwatchd
Previously, the system stored passwords in the /var/lib/pgsql/.pgpass
file.
If the /root/.pgpass
file does not exist, the system copies the .pgpass
file to the /root/.pgpass
file.