How do I recover/reset the postgres password?

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

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like