I have forgotten the password that I used while installing postgres. It asks for the password for every action I perform. What can I do in this case?

I've even tried removing postgres and reinstalling it again, but it still asks for the password.


In general you can use the following procedure: Go to the terminal and type:

sudo -u postgres psql

When you're logged in and the psql prompt appears then issue this SQL command:

ALTER USER postgres PASSWORD 'newpassword';

This may have consequences for any software using these login details too, so check if everything is still working after doing this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.