I have a client that has a PostgreSQL database and he cannot remember the password that we used when the database was setup. Is there a way to recover that information so I do not have to blow away his database and start from scratch?
The database is running on a PC.
Step 1: Edit PostgreSQL config file to establish trust relationship to login without password:
Old Line:
Change it to:
Step 2: Restart PostgreSQL Server:
Step 3: Change password:
Step 4: Password has been updated. Revert back the original settings of config file:
Old Line:
Change it to:
Step 5: Restart server and use your new password to access PostgreSQL Server.
Source
For 9.2, in windows:
Stop the service:
Modify the config file, change data/pg_hba.conf, basically md5 to trust:
Start the service:
Execute the sql statement to set your desired password, on a sql console or using psql:
Put back the original config file.