感谢您的回复。我已经在 pg_hba.conf 中配置了你的响应:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
修改密码:
# nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
# /etc/init.d/postgresql restart
# su - postgres
$ psql -U postgres -p 5433 -h localhost
Password for user postgres:
认证服务器提示我输入psql。下面的配置是让我不用密码就可以进入psql:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
修改密码:
# nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
# /etc/init.d/postgresql restart
# su - postgres
$ psql -U postgres -p 5433 -h localhost
postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
$ exit
# nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
# /etc/init.d/postgresql restart
更改设置并再次进入psql:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# su - postgres
$ psql -U postgres -p 5433 -h localhost
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"