2017-09-21 18 views
0

私はローカルでPostgreSQLデータベースを作成しました。 Postgre databasepostgresのRuby on Rails認証エラー

ここに私のdatabase.ymlファイルがあります。 デフォルト:&デフォルト アダプタ:postgresqlの プール:5 タイムアウト:5000

development: 
    <<: *default 
    database: myrubyblog 
    username: postgres 
    password: Naruto1994. 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    <<: *default 
    database: myrubyblog 
    username: postgres 
    password: Naruto1994. 

production: 
    <<: *default 
    database: myrubyblog 
    username: postgres 
    password: Naruto1994. 

私は、正しいパスワードを入力してください行われてきたが、私はまだ、このエラーを取得しています。

Error in the code

+0

パスワードからパスワードを削除してみませんか?また、どのようにあなたのデータベースを作成するのですか?実際にこのパスワードをpsqlに設定しましたか? – NeoVe

答えて

1

あなたがローカルホストを追加し、あなたがそれぞれの環境(開発、テスト、および生産)

development: 
    adapter: postgresql 
    encoding: unicode 
    database: myrubyblog_development 
    host: localhost 
    username: postgres 
    password: Naruto1994. 
    pool: 5 

test: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: myrubyblog_test 
    username: postgres 
    password: Naruto1994. 
    pool: 5 

production: 
    adapter: postgresql 
    encoding: unicode 
    database: myrubyblog_production 
    pool: 5 
    host: localhost 
    username: #env_variable 
    password: #env_variable 
間のドットまたはドットなし(Naruto1994)、そして私の提案の分割データベース名とパスワードを持っている場合makesureあり
1

このようなメッセージは、pg_hba.confファイルで指定された認証方法に合格するまで、サーバーに接続して通話していることを示します。

はこれを試してみてください:

// set new password for user "postgres" 
$sudo su postgres -c 'psql --username=postgres' 
ALTER USER postgres with encrypted password 'your_password'; 
//change pg_hba.conf 
local all postgres md5 

はその後のpostgresを再起動します。

この記事はあなたを助けるかもしれない:Postgresql: password authentication failed for user "postgres"

0

あなただけの各ENVにhost: localhostを追加する必要があります。例えば

development: 
    <<: *default 
    database: myrubyblog 
    host: localhost 
    username: postgres 
    password: Naruto1994. 
関連する問題