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 ‘your_new_password’;
- exit
- go into the pg_hba.conf file and change back the authentication method