If you are seeing the following error in the cPanel error log (/usr/local/cpanel/logs/error_log) while creating a postgreSQL database from cPanel, you need to reset the password of postgres user from WHM >> SQL Services >> Postgres Config as given in the file /var/lib/pgsql/.pgpass
psql: FATAL: password authentication failed for user “postgres”
And the error – ERROR: role “cPanel_username” does not exist can be fixed by executing the following command as root.
cd /var/cpanel/users && for x in *; do su -c “createuser -S -D -R $x” postgres; done
It will create all the missing entries inside the postgreSQL database corresponding to the cPanel users.