Peer Authentication Issues When using pg_dump

Hi Friends,

I am trying to make backups of my database using pg_dump. When I pass my command, it throws up this error: password or peer authentication failed for user postgres (or whichever user I pass). Has anyone else seen this error? Note: I have edited the pg_hba.conf file and changed peer to md5, as per some suggestions I saw online but this has not helped. Many thanks in advance for your help.

You can by pass password by editing pg_hba.conf and change from md5 to trust

It will work and never ask for password, however doing that it is not recommended for security concern

What does your pg_dump command line look like? It would be helpful to see how you’re referring to the host and DB in particular.