{"id":2445,"date":"2015-11-20T23:50:27","date_gmt":"2015-11-20T14:50:27","guid":{"rendered":"http:\/\/blog.rutake.com\/techmemo\/?p=2445"},"modified":"2015-11-20T23:50:27","modified_gmt":"2015-11-20T14:50:27","slug":"peer-authentication-failed-for-user-postgres","status":"publish","type":"post","link":"https:\/\/blog.rutake.com\/techmemo\/2015\/11\/20\/peer-authentication-failed-for-user-postgres\/","title":{"rendered":"Peer authentication failed for user &#8220;postgres&#8221;"},"content":{"rendered":"<p>\u4e45\u3005\u306bPostgreSQL\u3092\u5229\u7528\u3057\u305f\u3089\u3001\u6848\u306e\u5b9a\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u3067\u306f\u307e\u308b\u3002<br \/>\n\u57fa\u672c\u7684\u306bpostgres\u30e6\u30fc\u30b6\u3067\u30ed\u30fc\u30ab\u30eb\u3067\u4f5c\u696d\u3059\u308b\u5206\u306b\u306f\u554f\u984c\u767a\u899a\u3057\u306a\u3044\u306e\u3067\u3042\u308b\u304c\u3001\u5225\u306e\u30e6\u30fc\u30b6\u30fc\u3067\u3064\u306a\u3054\u3046\u3068\u3057\u305f\u3089\u4ee5\u4e0b\u306ePeer authentication failed for user &#8220;postgres&#8221;\u304c\u51fa\u305f\u3002<\/p>\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u610f\u5473\u306funix\u30e6\u30fc\u30b6\u30fc\u3068\u540c\u3058\u30a2\u30ab\u30a6\u30f3\u30c8\u3058\u3083\u306a\u3044\u3068\u3060\u3081\u3068\u3044\u308f\u308c\u3066\u3044\u308b\u3002<br \/>\n\u5916\u90e8\u304b\u3089\u63a5\u7d9a\u3059\u308b\u5834\u5408\u306f\u3053\u306e\u8a8d\u8a3c\u65b9\u5f0f\u306f\u90aa\u9b54\u306a\u306e\u3067\u901a\u5e38\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306b\u5909\u3048\u3066\u304a\u304f\u3002<\/p>\n<p>AmazonLinux\u306e\u5834\u5408\u306a\u305c\u304b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c~postgres\/data\u306b\u306f\u306a\u304f<br \/>\n\/var\/lib\/pgsql9\/data\u306b\u5b58\u5728\u3059\u308b\u3002<\/p>\n<p>[shell]<br \/>\n# psql -U postgres template1<br \/>\npsql: FATAL:  Peer authentication failed for user &#8220;postgres&#8221;<br \/>\n$ vi pg_hba.conf<br \/>\n#peer\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066md5\u306b\u3057\u305f\u3082\u306e\u3092\u8ffd\u52a0<br \/>\n#local   all             all                                     peer<br \/>\nlocal   all             all                                     md5<br \/>\n# \u518d\u8d77\u52d5\uff01<br \/>\n# \/etc\/init.d\/postgresql restart<br \/>\nStopping postgresql service:                               [  OK  ]<br \/>\nStarting postgresql service:                               [  OK  ]<br \/>\n[\/shell]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e45\u3005\u306bPostgreSQL\u3092\u5229\u7528\u3057\u305f\u3089\u3001\u6848\u306e\u5b9a\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u3067\u306f\u307e\u308b\u3002 \u57fa\u672c\u7684\u306bp &hellip; <a href=\"https:\/\/blog.rutake.com\/techmemo\/2015\/11\/20\/peer-authentication-failed-for-user-postgres\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,244],"tags":[366],"_links":{"self":[{"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/posts\/2445"}],"collection":[{"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/comments?post=2445"}],"version-history":[{"count":1,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/posts\/2445\/revisions"}],"predecessor-version":[{"id":2446,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/posts\/2445\/revisions\/2446"}],"wp:attachment":[{"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/media?parent=2445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/categories?post=2445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.rutake.com\/techmemo\/wp-json\/wp\/v2\/tags?post=2445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}