Today's Question:  What are bad parts of Windows 10?       GIVE A SHOUT

Technical Article => Cloud =>  Cloud

Change password of postgres account in Postgres

 sonic0002     2013-03-04 01:51:02      1,184    0    0

When installing Postgres on Windows, there is some default account created for user to login. One of them is postgres, but we often don;t know what's the password for this account when we first login using this account. We need to change the password for this account. How to change it?

Step 1. Modify the pg_hba.conffile

Go to the /data/ and open the pg_hba.conf.

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

For the method, the default is md5 which means it needs a password, so here we need to change the method to trust and then save it

host    all             all             127.0.0.1/32            trust

This means user can login without any password.

Step 2 . Login to Postgres server

Once the above is done, we can login to Postgres using psql command(Postgres client) to login:

psql -U postgres

Then we can enter the psql command line mode, now we can execute the below SQL command:

ALTER USER postgres WITH PASSWORD '';

Once the above is executed, the password is changed

Step 3. Revert the login method

Now modify the pg_hba.conf file and change the method back to md5 and save it and restart the Postgres service.

Now you can using the new password to login now.

 Tags : Postgres,password, user account   Read(1,184) Comment(0) Version(0)

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

 RELATED


 COMMENT  (TOTAL 0 COMMENT)


No comment for this article.


Nickname  
Email 
Comment

Hosted with love by Github

By sonic0002
A cute footer seen on JSch's website http://www.jcraft.com/jsch/examples/Shell.java.html. We geeks are not so boring sometimes.

 CONTRIBUTE


Share your geeky stuff now.
You make the world better, the world makes us better.

 WRITE ARTICLE

 VERSION


No other version available yet.