If you have forgotten the PostgreSQL main/primary password, which is most likely the password for the postgres user role, you can use these steps to reset this password.  This document is geared towards pgAdmin 3.



1.  Make a backup copy of your pg_hba.conf file. The default location is C:\ProgramData\PostgreSQL\9.3\data\pg_hba.conf


2.  Open the original pg_hba.conf file using a text editor.  You'll have to run the text editor with administrator rights in order to save changes to the file.  For example, search for notepad in the Windows start menu, right-click it and select "run as administrator".


3.  Add these 2 lines to the top of the file and save it. Please make sure the file name and extension don't change.


host all all 127.0.0.1/32 trust

host all all ::1/128 trust



4.  If you've been saving the pgAdmin password, please browse to the folder C:\Users\your_user_account\AppData\Roaming\postgresql and delete the file pgpass.conf.


5.  Launch PGAdmin. Double click on the Server to open it. Leave password blank, make sure Store password is unchecked and click OK.




6.  Go to File/Change Password. Leave ‘Current Password’ blank. Enter new password twice. Click OK. 



7.  Open the original pg_hba.conf file using a text editor that was started with administrator rights.


8.  Remove the 2 lines at the top of  the pg_hba.conf file and save the file. Please make sure the file name and extension don't change.



Note:  If you cannot save changes to the file even if you run the text editor as administrator, you can copy the original file to a secondary backup file and delete the original file.  Then, edit the new copy of the file, make the changes, and use the save-as feature to save it back to the original filename.