【问题标题】:mysql2 not working after upgrading mysql to 8将mysql升级到8后mysql2无法正常工作
【发布时间】:2021-06-28 06:17:01
【问题描述】:

我最近将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

【问题讨论】:

    标签: macos mysql2 ruby-on-rails-5.1


    【解决方案1】:

    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 文档中提到了上述内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-04
      • 2013-07-03
      • 2017-07-04
      • 1970-01-01
      • 1970-01-01
      • 2015-11-03
      • 2020-08-20
      • 2020-05-30
      相关资源
      最近更新 更多