How to change PostgreSQL user password?
我如何更改PostgreSQL用户的密码?
For password less login:
sudo -u user_name psql db_name
To reset the password if you have forgotten:
ALTER USER user_name WITH PASSWORD 'new_password';
Then type:
sudo -u postgres psql
Then:
password postgres
Then to quit:
q
If that does not work, reconfigure authentication.
Edit /etc/postgresql/9.1/main/pg_hba.conf
(path will differ) and change:
local all all peer
to:
local all all md5
Then restart the server:
sudo service postgresql restart
您可以并应该加密用户的密码:
ALTER USER username WITH ENCRYPTED PASSWORD 'password';
链接地址: http://www.djcxy.com/p/56966.html
下一篇: 如何更改PostgreSQL用户密码?