When i lost my postgres password

The pg_hba.conf is a configuration file that provides the first level of access to postgres, providing client authentication. This file provides a gateway by defining the ip addresses that connect to a database and the databases that are available. Postgres listens for connection using unix socket. A simple netstat | grep postgres reveals the socket.

This configuration file has a set of records. Every record talks about who connects to which database and the authentication method to be used. Postgres stops processing when it finds the first line that matches the connection.


(here Deigo Benna saved my life


specifically for postgres 8.4 users it is in:

sudo gedit /etc/postgresql/8.4/main/pg_hba.com

this file was located by me after a lot of trial and error .. and here i felt so so very proud.. in this process i learnt about md5 encryption using hashing and the fact that postgres uses it .. i also learnt that all the sites on the internet claiming that they can decrypt such a password are baloney meadow muffins .


here i troubleshooted the ident authentication error and an error that resulted from editing the file above incorrectly

what worked was the following changes


tips to remember:

1]etc is not in the home folder hence it is a good idea to “cd ..”

2]always sudo your commands

3]this blog was very helpful -http://scratching.psybermonkey.net/2009/06/postgresql-how-to-reset-user-name.html

though  not totally apt in my case but helpful nevertheless

4] finally after altering the file everytime, one needs to restart the postgres system with

sudo /etc/init.d/postgresql restart

5]My password now is amma and i really don’t think that my naive “employee” table is under any threat after this confidential information infiltrates the world wide web.


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s