How to change the PostgreSQL password (Windows)

How to change the PostgreSQL password (Windows)

This is a method to change the database password for PostgreSQL installed in a Windows environment.

The prerequisite is that you know the current password. The user is postgres, and we will change the password for this user.

Connect to the database with the current password, e.g. A5M2.

Issue the following Alter statement

ALTER USER postgres WITH PASSWORD 'New Password';

Now when you disconnect DB and reconnect, the password is changed to the new password.