Gem :: LoadError:指定' mysql'对于数据库适配器,但未加载gem

时间:2014-11-16 08:06:14

标签: mysql ruby-on-rails ruby-on-rails-4 heroku gem

在我的gemfile中:

group :development, :test,:production do gem 'mysql2', '~> 0.3.16' end

在日志中:

$ heroku run rake db:migrate

Running rake db:migrate attached to terminal... up, run.3758 rake aborted!

Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loaded. Add gem 'mysql' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

我添加了" cleardb"应用程序的附加组件。现在我想使用它。但是,由于我遇到上述错误,我无法迁移到数据库。

1 个答案:

答案 0 :(得分:6)

设置DATABASE_URL后,您需要指定使用mysql2://代替mysql://

这样的事情:

heroku config:set DATABASE_URL='mysql2://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true'