Menu & Search
Reset Default PostgreSQL User Password

Reset Default PostgreSQL User Password


If you forget what you entered as the postgres user password during installation, then this is a guide for you!

It’s exactly what I did which is the reason for a post. The shameful thing for me is that only a hour had passed since installing PostgreSQL, I was left searching the web to get the info below!


How to Reset the ‘postgres’ User Password

1. Open your pg_hba.conf file.
This can be found in your data directory, C:\Program Files\PostgreSQL\10\Data being the default path or C:\pgdata for me.

2. Change the method within the pg_hba.conf file as highlighted below, from ‘md5’ to ‘trust’.

Postgres pg_hba Config File

3. Restart the postgresql service.

4. Open the SQL Shell (psql) application, connect and execute the ALTER statement as shown.

psql ALTER DATABASE

5. Now open PGAdmin and you’re back in action.