PostgreSQL: password authentication failed for user

Everything was working fine. Then for no apparent reason PostgreSQL started failing with the error message:

FATAL:  password authentication failed for user

WTF???

.pgpass had my user name along with postgres. Running this worked:

psql -U postgres -h localhost -p 5432

This failed:

psql -U my_username -h localhost -p 5432

This allowed me to manually enter the password and by pass .pgpass, but it still failed:

psql -U my_username -h localhost -p 5432 -W

This allowed me to list the users:

psql -c '\du' -U postgres

And that is how I discovered that my password had expired. I did not even know it could expire. I fixed it in pgadmin.

It’s Back…

So I had things working. I was do a lot of work using pg_restore. All of a sudden, password auth failed again. The above procedures were no help. In pgadmin I re-entered the password. Now its working again.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s