在通过Capistrano我的Sinatra项目部署(首次部署)时,我在第一次迁移时遇到了问题(我正在使用activerecord):
致命:数据库“root@127.0.0.1/app”不存在
但它在服务器(ubuntu)上连接良好
root@wallget:~# psql -U root -d app -h 127.0.0.1
psql (8.4.17)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
app=> \q
在应用配置中,我有:
db = URI.parse(ENV['DATABASE_URL'] || 'postgres:///root@127.0.0.1/app')
ActiveRecord::Base.establish_connection(
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
:host => db.host,
:username => db.user,
:password => db.password,
:database => db.path[1..-1],
:encoding => 'utf8'
)
这是我的pg_hba.conf行:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
可能是什么问题?我正在部署我的vps,而不是Heroku。
答案 0 :(得分:1)
尝试postgres://root@127.0.0.1/app
(两个斜杠而不是三个)