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 https://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html
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.