- 我安装
PostgreSQL
在EC2
计算机上,现在我想更改用户密码postgres
- 我做
$ sudo -u postgres psql psql (9.1.5) Type "help" for help. postgres=# ALTER USER postgres WITH PASSWORD 'newpasswd'; ALTER ROLE
- 然后我退出外壳并尝试使用新密码登录
$ psql -U postgres -W Password for user postgres: psql: FATAL: Peer authentication failed for user "postgres"
我的PostgreSQL
版本是
$ psql --version
psql (PostgreSQL) 9.1.5
contains support for command-line editing
我做错了什么?
谢谢
我进行了更新pg_hba.conf
,这就是现在的样子
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all peer
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
然后我重新启动了 postgres
$ sudo /etc/init.d/postgresql restart
* Restarting PostgreSQL 9.1 database server [ OK ]
我尝试再次登录,但失败
$ psql -U postgres -W
Password for user postgres:
psql: FATAL: Peer authentication failed for user "postgres"
旧密码可能仍存储在〜/ .pgpass文件中。
@willglynn,请检查我的更新,它再次,即使在更改后失败
—
做白日梦的人
pg_hba.conf