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 2touch /etc/tailwatchddisable killall tailwatchd -
Edit the
/var/lib/pgsql/data/pg_hba.conffile and change themd5value to thetrustvalue. -
Restart PostgreSQL. To do this, run the
/usr/local/cpanel/scripts/restartsrv_postgresqlcommand. -
Change the PostgreSQL password. To do this, run the following command, where
new_passrepresents the new password:postgres=# alter user postgres with encrypted password =new_pass postgres=# q -
Edit the
/var/lib/pgsql/data/pg_hba.conffile and change thetrustvalue to themd5value. -
Remove the Tailwatch touch file and restart the service. To do this, run the following commands:
1 2rm /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.