How to change user password in PostgreSQL?

1. Using SQL query:

You can run this query:

ALTER USER user_name WITH PASSWORD 'new_password';

2. Using psql:

sudo -u user_name psql

Then run this and enter your password at the prompt:

\password user_name

Then quit psql:

\q

And restart the server:

sudo service postgresql restart

Need a good GUI tool for PostgreSQL? Check out TablePlus. It’s native, beautiful, and available for free.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS.

TablePlus GUI Tool PostgreSQL