To modify a user’s password in PostgreSQL via the psql CLI use the below syntax.
- [postgres@server pgsql]# psql -U postgres
- postgres=# ALTER USER user WITH PASSWORD 'password';
Change user to the proper username and password to the new password you want to set. You will see a “ALTER ROLE” confirmation after issuing the command.