将 mysql 升级到 8 后 mysql2 不起作用

问题描述

我最近将 MysqLMysqL8.0.4 更新为 MysqL5.7。我将 MysqL2 gem 从 0.4.9 更新为 0.5.3 之后我开始收到以下错误

/Users/user/.rvm/gems/ruby-2.4.0@talent_Now/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': 
Specified 'MysqL2' for database adapter,but the gem is not loaded. Add `gem 'MysqL2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

我试图将 MysqL2 降级到 0.4.9 但后来我得到了

/usr/local/Cellar/MysqL/8.0.25_1/include/MysqL/MysqL.h:187:3: note: 'MysqL_DEFAULT_AUTH' declared here
  MysqL_DEFAULT_AUTH,^
client.c:1315:38: error: use of undeclared identifier 'MysqL_SECURE_AUTH'; did you mean 'MysqL_DEFAULT_AUTH'?
  return _MysqL_client_options(self,MysqL_SECURE_AUTH,value);
                                     ^~~~~~~~~~~~~~~~~
                                     MysqL_DEFAULT_AUTH
/usr/local/Cellar/MysqL/8.0.25_1/include/MysqL/MysqL.h:187:3: note: 'MysqL_DEFAULT_AUTH' declared here
  MysqL_DEFAULT_AUTH,^
2 errors generated.
make: *** [client.o] Error 1

make Failed,exit code 2

我在 mac catalina 中使用 Rails5.1.4

解决方法

mysql2 0.5.xRails5.1.4 不兼容, 所以我将 Rails 更新为 5.1.7 以使其正常工作。

mysql2 0.5.x works with Rails / Active Record 4.2.11,5.0.7,5.1.6,and higher.

mysql2 文档中提到了上述内容。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...