在 postgresql 9.5.1 中,我创建了一个名为 GuardDog_02 的用户。我给了它密码。我给了它创建数据库和用户的权限:
CREATE USER GuardDog_02 WITH PASSWORD 'apple100' CREATEDB CREATEUSER;
Run Code Online (Sandbox Code Playgroud)
然后在 GuardDog_02 系统用户(Mac OSX)下:
$ psql -d template1
Password:
psql: FATAL: password authentication failed for user "GuardDog_02"
Run Code Online (Sandbox Code Playgroud)
我更新密码只是为了确保我输入正确:
template1=# ALTER USER GuardDog_02 WITH PASSWORD 'apple100';
Run Code Online (Sandbox Code Playgroud)
仍然说密码验证失败。我也检查了 pg_hba.conf 文件:
# 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
# IPv6 local connections:
host all all ::1/128 md5
# …Run Code Online (Sandbox Code Playgroud)