2013-11-04 40 views
13

我最近安装了postgresql 9.1和pgadmin3。但我无法连接到我与此配置创建的服务器:pgadmin3服务器连接和身份验证错误

name: mydb 
host: 127.0.0.1 
port: 5432 
service: 
Maintenance DB: postgres 
username: postgres 
password: * 

根据类似的问题我已经把我的/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 

但是,当我要连接到我得到这个错误服务器:

Error connecting to the server: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"

+0

您是什么时候创建用户'postgre'并为其分配密码的? –

回答

35

安装postgresql后,这很简单,我应该改变postgres用户密码 ,我的失败是因为这一点。该密码可以简单地改变通过这个ubuntu下命令12.04 LTS:

sudo -u postgres psql 

然后在PSQL:

\password 

现在输入新密码并重新输入。 没关系!那么你可以直接登录。 这种方式不需要改变pg_hba.conf文件的配置。

事实上,由于密码无效,我无法登录!

+0

这对我有效:) –

+3

提示:通过输入'\ q'离开postgres – ahnbizcad

+0

它适用于我。 –

2

看来你的数据库被配置为“Postgres的”用户和pgAdmin是一个尝试(在后面没有s)连接为“postgre”。

+0

没有那是我的错在复制和粘贴名称。 – muradin