Reset password of postgresql in Windows

Recently I was working in PostgreSql. The database was installed long back ago and I forgot the password of postgres user. After some search I found the way to reset the password without knowing it. Let me share the tricks.

I have installed PostgreSQL 9.3 in windows machine. Open C:Program FilesPostgreSQL9.3datapg_hba.conf (location may be different in different system/version).

Change the connection method to trust. You can find whole lot of information about pg_hba.conf from

Now you can login in postgresql database with the postgres username without any password.

You can change the password for future login.

Open sql editor. Execute below command to reset the password of postgres user id.
ALTER USER “postgres” WITH PASSWORD ‘passwword’;

(extra w is not typo. its intentional 😉 ).

The password is changed. Revert the changes in pg_hba.conf.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.