2016-09-03 7 views
1

FATAL:ピア認証は、ユーザーのために失敗しました「店」私がやったこと

sudo -u postgres psql 
CREATE ROLE shop CREATEDB LOGIN PASSWORD 'kurt1245'; 

それから私は今、自分のパスワードを書いて、ためにdatabase.ymlを編集し、GitHubの(PGを使用してRailsアプリケーション)、bundle installからリポジトリをクローン化しましたrake db:create(またはsetupおよびmigrate)の後も機能しません。

database.yml

development: adapter: postgresql encoding: unicode database: shop_development pool: 5 username: shop password: kurt1245 test: adapter: postgresql encoding: unicode database: shop_test pool: 5 username: shop password: kurt1245

+0

重複の:http://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge – Loqman

答えて

6

私は数日戻って同じエラーを持っていました。

編集/etc/postgresql/$version/main/pg_hba.conf

あなたはselect VERSION();

変更pg_hba.confインサイド

local all postgres peer

のようにpsqlのコンソールで使用しているどのバージョンかを確認することができます:

local all postgres md5

Peer Authentication explained

19.3.7。ピア認証

ピア認証方法は、クライアントの オペレーティングシステムのユーザー名をカーネルから取得し、許可された データベースユーザー名(オプションのユーザー名マッピングを使用)として使用することによって機能します。この方法は、ローカル接続でのみサポートされている です。

6

ホストをdatabase.ymlファイルに追加してください。それがあなたを助けることを願っています。

development: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: shop_development 
    pool: 5 
    username: shop 
    password: kurt1245 

test: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: shop_test 
    pool: 5 
    username: shop 
    password: kurt1245 
関連する問題