Skip to content

Reset PostgreSQL password in Windows

  1. Go to C:\Program Files\PostgreSQL\9.6\data – replace 9.6 with whatever version your on. This is the default installation path. If you installed your PostgreSQL somewhere else, then change the path accordingly
  2. Make a backup of pg_hba.conf
  3. Open and edit pg_hba.conf
  4. You will see a line like host all all 127.0.0.1/32 md5
  5. Replace md5 with trust, so it becomes host all all 127.0.0.1/32 trust
  6. Do the same for the ipv6
  7. Restart your PostgreSQL service by running services.msc or Task Manager -> Services
  8. Open CMD
  9. Run psql -U postgres -h localhost
  10. Run the command ALTER USER postgres with password ‘NewPassword’;
  11. Revert changes to pg_hba.conf and restart postgres service again.
  12. Done

Enjoyed the content ? Share it with your friends !
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published.