Knowledgebase: Adams Database
Reset lost PostgreSQL admin password
Posted by Mont Rothstein on 13 January 2012 06:23 PM

Reset lost PostgreSQL admin password

If the PostgreSQL admin/superuser account password is lost follow this procedure to reset it.
  1. Create a copy of pg_hba.conf so you can revert to it later
  2. Open pg_hba.conf
  3. Change "md5" to "trust" everywhere
  4. Go to the command line (cmd.exe)
  5. CD into the PostgreSQL bin directory (ex: C:\Program Files\PostgresSQL\9.0\bin)
  6. Enter: psql -U postgres ForayAdams (NOTE: if the admin account isn't postgres user whatever the admin account is named; likewise for the db being ForayAdams)
  7. Enter: ALTER USER postgres WITH ENCRYPTED PASSWORD 'somestrongpassword'; (NOTE: again, change postgres if necessary)
  8. Enter: \q
  9. Start PgAdmin III and enter the password just set to make sure it works.
  10. Swap the pg_hba.conf back to the previous version.
 

Comments (0)