Rails:无法连接PostgreSQL数据库

时间:2016-12-23 02:41:19

标签: ruby-on-rails postgresql

这是我的database.yml:

production:
<<: *default
database: skilltracker_production
username: skilltracker
password: <%= ENV['SKILLTRACKER_DATABASE_PASSWORD'] %>

当我运行bundle exec rake db:create:all时,收到以下错误消息: fe_sendauth: no password supplied

[...]

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"skilltracker_development", "host"=>"localhost"} FATAL: Peer authentication failed for user "skilltracker"

[...]

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"skilltracker_development", "username"=>"skilltracker", "password"=>"skilltracker"}

[...]

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"skilltracker_production", "username"=>"skilltracker", "password"=>nil}

有什么理想吗?谢谢你的帮助!

1 个答案:

答案 0 :(得分:0)

完整性检查:您是否实际将密码存储在该环境变量中?尝试在该字段中对其进行硬编码,作为故障排除步骤。