Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rails 5和Ruby 2.3.3未能加载libmysql.dll_Mysql_Ruby On Rails_Ruby_Ruby On Rails 5_Mysql2 - Fatal编程技术网

Rails 5和Ruby 2.3.3未能加载libmysql.dll

Rails 5和Ruby 2.3.3未能加载libmysql.dll,mysql,ruby-on-rails,ruby,ruby-on-rails-5,mysql2,Mysql,Ruby On Rails,Ruby,Ruby On Rails 5,Mysql2,为使用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) [i

为使用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.
我已经尝试了来自的解决方案,但没有成功


感谢您的帮助。

将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

作为对该线程的更新,指定gem的平台为我完成了任务

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'

谢谢。您是如何知道这个版本的mysql2 gem将起作用的?请分享事实上,在我的系统中,我有一个应用程序运行在Rails 4和mysql2 gem版本0.3.21中,运行良好。在同一台机器上,我有另一个应用程序,rails 5和mysql2版本为0.4.7,这一个出现了问题。所以我非常确定它与MYSQL安装无关。所以我将mysql2的版本0.3.21降级为Rails 4应用程序,幸运的是它确实对我起了作用。在尝试此操作之前,我卸载并安装了mysql,甚至OS:)几乎2-3次,糟糕的是,我之前没有了解此技巧。谢谢,我在从安装rails 2.2 for windows之后遇到了相同的错误,请按照您的方法操作。