Redrock Postgres Documentation
Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

I lost the database password. What can I do to recover it?

Description

I lost the database password. What can I do to recover it?

Answer

You can’t. However, you can reset it to something else. To do this, you

  • edit pg_hba.conf to allow trust authorization temporarily
  • Reload the config file (pg_ctl reload)
  • Connect and issue ALTER ROLE PASSWORD to set the new password
  • edit pg_hba.conf again and restore the previous settings
  • Reload the config file again