I have installed PostgreSQL on my Windows machine for development. Now I haven't used it for a while, and have forgotten the password for user postgres
(default admin user in PostgreSQL). How can I reset the password for postgres
in PostgreSQL on Windows?
I followed Milen's suggestion, but got this message when trying to reload the configuration file:
C:\Program Files\PostgreSQL9円.1\data>pg_ctl reload -D .
pg_ctl: could not send reload signal (PID: 3396): Operation not permitted
In Windows there is a menu option "Reload Configuration" that worked better, as shown below:
enter image description here
1 Answer 1
From the 9.0 FAQ, I lost the database password. What can I do to recover it?:
I lost the database password. What can I do to recover it?
You can't. However, you can reset it to something else. To do this, you
- Edit
pg_hba.conf
to allow trust authorization temporarily - go here for its location- Reload the config file (
pg_ctl reload
)- Connect and issue
ALTER ROLE postgres WITH PASSWORD 'newpassword';
to set the new password (for first time users note the semi-colon)- Edit
pg_hba.conf
again and restore the previous settings- Reload the config file again
-
4Can you explain
Reload the config file (pg_ctl reload)
? How do you do that?CodyBugstein– CodyBugstein2014年08月25日 02:22:03 +00:00Commented Aug 25, 2014 at 2:22 -
Run 'pg_ctl' as windows root authentication안재형– 안재형2017年03月03日 05:33:08 +00:00Commented Mar 3, 2017 at 5:33
Explore related questions
See similar questions with these tags.