09-08-2023, 01:17 PM
Changing the default postgres role password is essential to improve database security. Here’s how to do it:
Activate the PostgreSQL prompt using this command:
sudo -u postgres psql
Run this statement to change the postgres account password. Don’t forget to replace NewPassword with your actual password:
ALTER USER postgres PASSWORD 'NewPassword';
Check whether the change is applied successfully using the following command:
\p
Restart the PostgreSQL service using this command:
sudo service postgresql restart


