代码之家  ›  专栏  ›  技术社区  ›  Satishakumar Awati

Rails 5和Ruby 2.3.3无法加载libmysql.dll

  •  2
  • Satishakumar Awati  · 技术社区  · 7 年前

    为使用mysql数据库创建的应用程序启动服务器时,控制台中会记录以下错误消息。

    Failed to load libmysql.dll from C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\mysql2-0.4.7-x86-mingw32\vendor\libmysql.dll
    

    Window 7 64 bit
    Rails 5.0.4
    ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
    mysqld  Ver 5.7.18 for Win64 on x86_64 (MySQL Community Server (GPL))
    

    控制台上收到来自mysql2 ruby gem的安装后消息。

    You've installed the binary version of mysql2.
    It was built using MySQL Connector/C version 6.1.10.
    It's recommended to use the exact same version to avoid potential issues.
    
    At the time of building this gem, the necessary DLL files were retrieved from:
    http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.10-win32.zip
    
    This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
    

    here 但不起作用。

    2 回复  |  直到 7 年前
        1
  •  5
  •   Satishakumar Awati    7 年前

    将mysql2 rubygem从版本0.4.7降级到0.3.21解决了我的问题。

    以下是我遵循的步骤

    rails new blog -d mysql # created application with mysql as database
    gem uninstall mysql2 #uninstalled mysql2-0.4.7
    Gemfile :
        gem 'mysql2', '0.3.21' #Gemfile changed mysql2 version to 0.3.21
    bundle update mysql2 #installed mysql2-0.3.21 version
    
        2
  •  2
  •   Youness    6 年前

    gem uninstall mysql2
    gem install mysql2 --platform=ruby
    

    以下是我的版本详细信息:

    Windows OS
    Ruby 2.5.0p0 (2017-12-25 revision 61468) [i386-mingw32]
    Rails 5.1.6
    Gemfile:
      gem 'mysql2', '0.5.1'