Today's Question: 


Different programming are similar in helping people build staff work as people want them to. But they all have their own features which differentiate them from other programming languages. The language type may be different, for example Java is OOP, some may have different syntax. A programming motto usually can best describe the characteristic of the programming language. For example, "Write once Run everywhere" for Java.Do you know any other programming language motto?
Do you know the mottos of programmig languages?
Description My Answer

Technical Article => Cloud =>  Cloud

Change password of postgres account in Postgres

Source : sonic0002    Date : 2013-03-04 01:51:02  

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               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               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:


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.

Save as PDF Mark as read Mark as important
By clicking the "Mark as read" button, this article will be marked as read. It will be removed from the homepage's latest news and the article list on the "Technical article" page in following visits and it will be put to your read list which you can find in "Amin->Article read list". There you can unmark the read articles.
By clicking the "Mark as important" button, this article will be put to your important article list which you can find in "Amin->Article important list". Later when you want reread this article, it's easier for you to find it by checking the "Article important list".

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

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious 

 Previous : PHP to get access token for Twitter app
 Next : /dev/null and /dev/tty in Linux

  ::Related Articles

  ::Comment Zone  (Total 0 comment)

No comment for this article.



:: Other versions

No other versions available yet.

:: Recent articles

:: Most read

:: Contribute

Want to share with the world your understanding about technology? Want to record the process you solve a technical problem? Want to make the world benefit from your understanding and solution? Write them down. You make the world better, the world makes us better.

Write article

:: Find us

Back to top