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.


1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .