2013-11-04 18 views
13

私は最近postgresql 9.1とpgadmin3をインストールしました。私はUbuntuの下にこのような12.04 LTS私/etc/postgresql/9.1/main/pg_hba.confファイルを設定した同様の問題によるとpgadmin3サーバ接続と認証エラー

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

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のユーザーパスワード を変更する必要があり、そのために失敗しました。

sudo -u postgres psql 

そして、psqlで:

\password 

今、それを新しいパスワードを入力し、再入力したパスワードは、単純にUbuntuの12.04 LTSの下でコマンドこのを通じて変更することができます。 これは問題ありません。単にサインインすることができます。 この方法では、pg_hba.confファイルの設定を変更する必要はありません。

実際、無効なパスワードのためにログインできませんでした。

+0

これは私のために働いた:) –

+3

ヒント: '\ q'をタイプすることによってポストグルから抜け出す – ahnbizcad

+0

それは私のために働く。 –

2

は、あなたのDBは「Postgresの」ユーザーのために設定されており、pgAdminでは(最終的にはSなし)「postgre」として接続しようとしているようです。

+0

それは私のせいでコピーして名前を貼り付けることができませんでした。 – muradin