Skip to main content
8 of 8
Commonmark migration

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

  1. Edit pg_hba.conf to allow trust authorization temporarily - go here for its location
  2. Reload the config file (pg_ctl reload)
  3. Connect and issue ALTER ROLE postgres WITH PASSWORD 'newpassword'; to set the new password (for first time users note the semi-colon)
  4. Edit pg_hba.conf again and restore the previous settings
  5. Reload the config file again
Milen A. Radev
  • 1.6k
  • 14
  • 13