Sat*_*ati 2 ruby mysql ruby-on-rails mysql2 ruby-on-rails-5
在为使用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
Run Code Online (Sandbox Code Playgroud)
环境细节:
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))
Run Code Online (Sandbox Code Playgroud)
来自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.
Run Code Online (Sandbox Code Playgroud)
我从这里尝试了解决方案,但没有奏效.
任何帮助表示感谢,提前谢谢.
将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
Run Code Online (Sandbox Code Playgroud)