简体   繁体   English

Rails Server无法正常运行(LoadErrror mysql2)Windows

[英]Rails Server not Working (LoadErrror mysql2) Windows

I am trying to run rails server command but it showing mysql2 Load Error. 我正在尝试运行Rails Server命令,但显示mysql2 Load Error。 I will place my Error log here 我将在这里放置我的错误日志 错误记录

I searched many places. 我搜寻了很多地方。 I tried to install from my bundle itself using "gem install mysql2 --ruby=platform" command using connector c "libmysql.dll" file pasted in ruby/bin but no use. 我尝试使用粘贴在ruby / bin中的连接器c“ libmysql.dll”文件,使用“ gem install mysql2 --ruby = platform”命令从捆绑包本身进行安装,但没有使用。

I actually have MySQL installed on my system long back when I was doing JDBC connections. 实际上,早在进行JDBC连接时,我的系统上就已经安装了MySQL。 Its SQL server version 5.0- Is that version causing this error? 它的SQL Server版本5.0-是该版本引起此错误吗? Or Do I need to uninstall the MySQL from my system and install Latest Version! 还是我需要从系统上卸载MySQL并安装最新版本! And a doubt for me is how is this MySQL Server 5.0 connected to Rails as I no I have no idea about it, because while installation I used Connector C 6.1 for mysql2 installation from the Command Promt! 对我来说,一个疑问是该MySQL Server 5.0如何连接到Rails,因为我不知道,因为在安装过程中,我使用连接器C 6.1从Command Promt安装mysql2!

I tried Ruby on Rails - cannot load such file -- mysql2/2.2/mysql2 (LoadError) 我尝试了Ruby on Rails-无法加载此类文件-mysql2 / 2.2 / mysql2(LoadError)

I also tried Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". 我还尝试了错误“ ...无法加载此类文件-mysql2 / 2.0 / mysql2(LoadError)”。 On Windows XP with Ruby 2.0.0 But I am getting the same error. 在装有Ruby 2.0.0的Windows XP上,但是出现了同样的错误。

I think I have given all the details regarding versions and what I did! 我想我已经提供了有关版本和所做的所有详细信息! I tried doing this like 50 times but no progress! 我尝试这样做50次,但没有任何进展! I hope I will get my problem solved !Thank You! 希望我能解决我的问题!谢谢!

im not using windows. 即时通讯不使用Windows。 but seems to be duplicate with posts like this ( Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0 ) 但似乎与这样的帖子重复( 错误“ ...无法加载此类文件-mysql2 / 2.0 / mysql2(LoadError)”。在具有Ruby 2.0.0的Windows XP上

The following below instructions can help you. 以下以下说明可以为您提供帮助。

gem uninstall mysql2

Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip下载最后一个MySQL连接器

Extract it to C:\\connector-6.0.2 将其解压缩到C:\\connector-6.0.2

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-
6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-
dir="C:\connector-6.0.2"'

Or even shorter: 甚至更短:

gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM