postgresql pgadmin3 服务器连接和身份验证错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19774742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pgadmin3 server connection and authentication error
提问by muradin
I have recently installed postgresql 9.1 and pgadmin3. But I can't connect to server which I created with this config:
我最近安装了 postgresql 9.1 和 pgadmin3。但是我无法连接到我用这个配置创建的服务器:
name: mydb
host: 127.0.0.1
port: 5432
service:
Maintenance DB: postgres
username: postgres
password: *
According to similar problems I've set my /etc/postgresql/9.1/main/pg_hba.conf
file under ubuntu 12.04 LTS like this:
根据类似的问题,我/etc/postgresql/9.1/main/pg_hba.conf
在 ubuntu 12.04 LTS 下设置了我的文件,如下所示:
local all postgres md5
# 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
host all all localhost trust
But when I want to connect to the server I get this error:
但是当我想连接到服务器时,我收到此错误:
Error connecting to the server: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
连接到服务器时出错:致命:用户“postgres”的
密码验证失败致命:用户“postgres”的密码验证失败
回答by muradin
That was simple after installation of postgresql i should change the postgres user password and my failure was because of that. The password can simply change through this commands under ubuntu 12.04 LTS:
安装 postgresql 后这很简单,我应该更改 postgres 用户密码,因此我失败了。在 ubuntu 12.04 LTS 下可以通过以下命令简单地更改密码:
sudo -u postgres psql
And then in psql:
然后在 psql 中:
\password
Now enter the new password and re-enter it.
That's OK! then you can simply sign in.
This way there is no need to change the configuration of pg_hba.conf
file.
现在输入新密码并重新输入。没关系!然后你就可以直接登录了。这样就不需要更改pg_hba.conf
文件的配置了。
In fact i failed to login because of my invalid password!
事实上,由于我的密码无效,我无法登录!
回答by Nailgun
Seems your DB is configured for "postgres" user and PgAdmin is trying to connect as "postgre" (without s in the end).
似乎您的数据库是为“postgres”用户配置的,而 PgAdmin 正尝试以“postgre”身份连接(最后没有 s)。