问题描述
我最近将 MysqL 从 MysqL8.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.x
与 Rails5.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 文档中提到了上述内容。