Reputation: 11
I had downloaded PostgreSQL unknowingly and I don't know the password now, how can I find it out or how to change it? Do I have to re-install it? Please Help
Edit: I'm using a windows os
Upvotes: 1
Views: 2870
Reputation: 187
Step 1. Reinforcement the pg_dba.conf record by replicating it to an alternate area or simply rename it to pg_dba_bk.conf
Step 2. Alter the pg_dba.conf document by including the accompanying line as the primary line after the remark lines. The remark line begins with the # sign.
local all all trust
host all postgres 127.0.0.1/32 trust
Step 3. Restart PostgreSQL server e.g., in Linux, you use the following command:
sudo /etc/init.d/postgresql restart
Step 4. Connect to PostgreSQL database server.
psql -U postgres
Step 5. change the password of the postgres user.
ALTER USER postgres with password 'very_secure_password';
Step 6. Restore the pg_db.conf file and restart the server, and connect to the PostgreSQL database server with new password.
sudo /etc/init.d/postgresql restart
Upvotes: 1