How to reset PostgreSQL password

January 23, 2021 | SQL MISC

That’s quite easy:

  • go into the installation folder
  • find pg_hba.conf file and open it
  • modify the authentication method to trust. (for me it was set to scram-sha-256)
  • restart the PostgreSQL server (in Windows: Run > Service > Find PostgreSQL, right click and select Restart)
  • try logging in without user & pass from SQL Shell (in Windows)
  • set/change password: alter user postgres with password ‘yournewpassword’;
  • exit
  • go into the pg_hba.conf file and change back the authentication method

~no comments
~post a comment: