The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Saturday, October 31, 2009

pg_dump fails:

$ pg_dump -o -U mydbuser mydb >

$ pg_dump: [archiver (db)] connection to database "mydb" failed: FATAL: password authentication failed for user "mydbuser"

My /var/lib/pgsql/data/pg_hba.conf :

# "local" is for Unix domain socket connections only
local all all ident sameuser
host all all md5

I thought that since I am logged into the postmaster machine, I would be able to enter the mydbuser database password and execute the command.

According to:

the option -h is the following:

-h host

Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.

Since I did not use -h flag in the command, pg_dump was using a Unix socket to connect the the database and therefore using the IDENT authentication option. I should could have said -h in my pg_dump command- like so:

$ pg_dump -o -U mydbuser -h mydb >

so that I could authenticate using the md5 database user password at the prompt.

Labels: ,


Post a Comment

<< Home