简体   繁体   English

加载“mysql2”活动记录适配器时出错

[英]Error loading the 'mysql2' Active Record adapter

I am trying to upgrade my app and this is the error I am getting while deploying the app:我正在尝试升级我的应用程序,这是我在部署应用程序时遇到的错误:

Error loading the 'mysql2' Active Record adapter.加载“mysql2”活动记录适配器时出错。 Missing a gem it depends on?缺少它所依赖的宝石? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21.无法激活mysql2 (< 0.6.0, >= 0.4.4),已经激活了mysql2-0.3.21。 Make sure all dependencies are added to Gemfile.确保所有依赖项都添加到 Gemfile。

here is my Gemfile: https://github.com/BI-CTSICN/sparc-request/blob/master/Gemfile这是我的 Gemfile: https : //github.com/BI-CTSICN/sparc-request/blob/master/Gemfile

 gem 'mysql2', '~> 0.3.18'
 gem 'rails', '~> 5.1', '>= 5.1.4'

I am using ruby 2.4.2我正在使用 ruby​​ 2.4.2

Your mysql2 version you use ( 0.3.21 , checked in Gemfile.lock ) is too old, required one is newer than 0.4.4 .您使用的mysql2版本( 0.3.21 ,在Gemfile.lockGemfile.lock )太旧,需要一个比0.4.4新。

Upgrade your mysql2 gem by changing version in Gemfile and running bundle update mysql2 .通过更改Gemfile版本并运行bundle update mysql2升级您的mysql2 gem。 Of course before that check what changed between versions and then run your tests to check if upgrade didn't break anything.当然,在此之前检查版本之间发生了什么变化,然后运行测试以检查升级是否没有破坏任何东西。

Just lock the mysql2 gem version not work for me.只是锁定 mysql2 gem 版本对我不起作用。 The only thing that work was match the rails gem version with mysql2 gem version, comparing both by it's release date.唯一有效的是将 rails gem 版本与 mysql2 gem 版本匹配,并按发布日期进行比较。

Ex: I'm updating now my rails version from 5.1 to 5.2, so I want to put mysql 0.5.3 on my application (the most recent version).例如:我现在将我的 rails 版本从 5.1 更新到 5.2,所以我想将 mysql 0.5.3 放在我的应用程序(最新版本)上。 But I can put only the 0.4.10 version, because of it's release date match with rails 5.2.0.rc2 version that I installed right now (both are from march, 2018, with one day of difference).但是我只能放 0.4.10 版本,因为它的发布日期与我现在安装的 rails 5.2.0.rc2 版本匹配(两者都来自 2018 年 3 月,有一天的差异)。

I don't know why this working, but I guess that's a incompatibility problem between the rails and mysql2 versions that I tried to install.我不知道为什么会这样,但我想这是我尝试安装的 rails 和 mysql2 版本之间的不兼容问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM