FATAL: Peer authentication failed for user “shop”
我做了什么:
1 2 | sudo -u postgres psql CREATE ROLE shop CREATEDB LOGIN PASSWORD 'kurt1245'; |
然后我从GitHub(一个使用pg的rails应用程序)克隆了一个存储库,
<5233>
请将主机添加到database.yml文件中。 希望它会对你有所帮助。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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 |
几天前我遇到了同样的错误。
编辑
您可以在psql控制台中查看您正在使用的版本
里面
至:
同行认证解释
19.3.7. Peer Authentication
The peer authentication method works by obtaining the client's
operating system user name from the kernel and using it as the allowed
database user name (with optional user name mapping). This method is
only supported on local connections.