我的VPS安装了
rbenv-vars,我在rails app里面的config目录下找到.rbenv-vars文件.我假装在其中加载数据库密码,但我做错了,因为rake db:create给了我一个无密码错误.当我将密码写为字符串时,Rake工作.
config/.rbenv-vars
DB_PASS=my_db_password
config/database.yml
password: $DB_PASS # Doesn't work #password: <%= ENV['DB_PASS'] %> # Doesn't work # password: my_db_password # Works
我得到所有变量运行rbenv变量
ssh > rbenv vars
export DB_PASS='my_db_password'
解决方法
通过
https://github.com/rails/rails/issues/19256#issuecomment-102980786
你可能需要做一个
spring stop
然后再试一次.这对我有用.