【发布时间】:2016-04-14 03:29:28
【问题描述】:
我正在尝试在 Ubuntu 14 上使用 Postgres 为 Rails 应用程序运行 Capistrano,在 rake db:migrate 期间遇到密码错误-
DEBUG [2823f146] Command: cd /home/ben/apps/mll/releases/20160414014303 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.0.0-p645" RAILS_ENV="production" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate )
DEBUG [2823f146] rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied
我尝试了类似帖子的所有解决方案,但没有运气。为了踢球,我还尝试在远程应用程序目录中运行该命令并得到以下结果:
PG::ConnectionBad: FATAL: password authentication failed for user "mll"
FATAL: password authentication failed for user "mll"
这很有趣,因为它使用我的数据库名称作为我的用户名。请参阅下面的database.yml,因此我添加了一个mll 角色,你瞧,它在运行rake db:migrate 时就起作用了。我尝试使用这个新角色再次运行 Capistrano,但仍然没有成功。
用户名没有被正确访问/存储是否合理?我有什么方法可以测试吗?我为我的ben 和mll 角色手动ALTER ROLE ben WITH PASSWORD 'mypw';,什么都没有。
我的数据库.yml:
defaults: &default
adapter: sqlite3
encoding: utf8
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/development.sqlite3_test
production:
<<: *default
host: localhost
adapter: postgresql
encoding: utf8
database: mll
pool: 5
username: <%= ENV['DATABASE_USER'] %>
password: <%= ENV['DATABASE_PASSWORD'] %>
\du:
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
ben | Superuser, Create role, Create DB | {}
mll | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication | {}
我读到将 md5 更改为 trust 帮助了一些人,我试过了,但我不确定如何重新启动,我看到的所有命令都对我不起作用。
pg_hba.conf:
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
【问题讨论】:
标签: ruby-on-rails postgresql capistrano