【问题标题】:Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loadedGem::LoadError: 为数据库适配器指定了“mysql”,但 gem 没有加载
【发布时间】:2015-01-13 07:46:44
【问题描述】:

在我的 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”插件。现在我想使用它。但是,由于出现上述错误,我无法迁移到数据库。

【问题讨论】:

  • 显示你的database.yml

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


【解决方案1】:

设置DATABASE_URL时,需要指定使用mysql2://而不是mysql://

类似这样的:

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

【讨论】:

    猜你喜欢
    • 2015-12-04
    • 2014-08-11
    • 1970-01-01
    • 1970-01-01
    • 2014-09-05
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    相关资源
    最近更新 更多