我最近在我的mac上下载了postgresql 9.4的图形安装并完成了整个设置,甚至设置了密码,但是当它激活shell时没有密码可以工作。我尝试了系统密码和我设置的密码,但都没有用。
每次我尝试
sudo -u postgres psql
我收到错误
psql: FATAL: password authentication failed for user "postgres"
这是我的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
Allow replication connections from localhost, by a user with the
replication privilege.
local replication postgres md5
host replication postgres 127.0.0.1/32 md5
答案 0 :(得分:0)
尝试更改您的psql密码
将conf文件中的本地更改为:local all all trust
重启psql server:
sudo /etc/init.d/postgresql restart
以超级用户身份连接postgres:
sudo -u postgres psql
更改密码:
ALTER USER postgres PASSWORD 'newpassword';
将您的conf文件更改为:
local all all md5
重新启动psql server:
sudo /etc/init.d/postgresql restart