mysql2 将 mysql 升级到 8 后无法使用

mysql2 not working after upgrading mysql to 8

我最近将 mysql 从 mysql5.7 更新为 mysql8.0.4。我将 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 文档中提到了以上内容。