Joe*_*ith 3 postgresql ruby-on-rails
当我尝试使用User.connection或generic-table.connection连接到我的pg数据库时,我收到此错误
PG :: ConnectionBad:致命:用户'用户名'的对等身份验证失败
我仔细检查了我的database.yml,它看起来不错.我认为问题在于我的pg_bha.conf文件?我现在无法在我的应用程序或系统中找到此文件.
database.yml的
development:
adapter: postgresql
encoding: utf8
database: project_development
pool: 5
username:
password:
test: &TEST
adapter: postgresql
encoding: utf8
database: project_test
pool: 5
username: name
password:
production:
adapter: postgresql
encoding: utf8
database: project_production
pool: 5
username: name
password:
cucumber:
<<: *TEST
Thanks for the help.
Run Code Online (Sandbox Code Playgroud)
首先,找到你的pg_hba.conf:
sudo find / -name "pg_hba.conf"
我的系统上是/var/lib/pgsql/data/pg_hba.conf.
确保在pg_hba.conf中更改此行:
local all all local
至 :
local all all md5
最后,重启postgresql:
OS X:
launchctl unload ~/Library/LaunchAgents/org.postgresql.postgres.plist
launchctl load ~/Library/LaunchAgents/org.postgresql.postgres.plist
Systemd:
sudo systemctl restart postgresql.service
sysvinit的:
sudo service postgresql restart
| 归档时间: |
|
| 查看次数: |
6284 次 |
| 最近记录: |