Reyan
Reyan

Reputation: 11

postgres 9.2 forgot password

I am very new to PostgreSQL, When I opened pgAdmin III and tried to connect with PostgreSQL 9.2 (x86) localhost

It asked me password of user openpg: (which we have forgotten)

I will appreciate if someone kindly help me to reset the password of our database (on Windows Platform) ?

Thanks & regards

Upvotes: 0

Views: 4276

Answers (1)

Tomonso Ejang
Tomonso Ejang

Reputation: 1366

add the line on top:

local    postgres     postgres     trust

C:\Program Files\PostgreSQL\8.4\data\pg_hba.conf

restart/reload postgres...

login to postgres... authentication will not be required...

ALTER USER postgres PASSWORD 'new_password';

where postgres is the username...

then finally edit the line we added at the beginning to...

local    postgres     postgres     md5

restart postgresql again... Now you should probably login using your new password you entered...


if the above doesn't work... add the following to the configuration file pg_hba.conf...

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# IPv4 local connections:
host    postgres             postgres             127.0.0.1/32            trust
# IPv6 local connections:
host    postgres             postgres             ::1/128                 trust

then reload the configuration or restart the service... now you could probably login without password... change the password...

if that works... finally, do not forget to replace "trust" with "md5"...

Upvotes: 2

Related Questions