Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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\PostgreSQL\9.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

share|improve this question
up vote 11 down vote accepted

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

  1. Edit pg_hba.conf to allow trust authorization temporarily
  2. Reload the config file (pg_ctl reload)
  3. Connect and issue ALTER ROLE / PASSWORD to set the new password
  4. Edit pg_hba.conf again and restore the previous settings
  5. Reload the config file again
share|improve this answer
Can you explain Reload the config file (pg_ctl reload)? How do you do that? – CodyBugstein Aug 25 '14 at 2:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.