本文介绍了无法使用Ruby on Rails 3加载libmysql.dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



1-rails新项目名称-d mysql

我正在使用RoR与mysql进行一个应用程序。 >

2-rails生成scaffold脚本标题:string body:text



运行第二步后,我收到以下错误。



错误:

 无法从C加载libmysql.dll: \Ruby193\lib\ruby\gems\1.9.1\gems\mysql2-0.3。 
18-x86-mingw32\vendor\libmysql.dll

我已经安装了mysql在我的系统中,将libmysql.dll文件从mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll复制到C:\Ruby193\bin仍然是上述错误。尝试帮助我解决这个错误,我也有兴趣知道我的mysql数据库是否存在于其他一些实例,而不是我的本地系统如何使用Rails连接。


解决方案

在一些Google工作之后,我正在使用Rails版本3.2.19和win-xp 并尝试一个Win2k3服务器,它似乎是一个问题的情况下,二进制版本的mysql2。



在最新版本的mysql2,它包含libmysql.dll不同于它需要在本地编译,libmysql.dll的版本来自MySQL Connector 6.1.x,它可以删除WinXp / 2k3的支持。



所以,你可以尝试这样我在我的红米成功安装:


  1. 卸载您的mysql2宝石通过 gem卸载mysql2 并删除所有mysql2包

  2. 从MySQL下载MySQL Connector / C NoInstall,该版本应低于6.1,在我的情况下为6.0.2(mysql-connector-c-noinstall-6.0.2- win32.zip),并解压缩到路径,如D:\MySQLConn

  3. 通过此命令安装mysql2: gem install mysql2 --platform = ruby - '--with-mysql-lib =D:\MySQLConn\lib--with-mysql-include =D:\MySQLConn\include'

  4. 运行Redmine的安装`bundle install - 没有开发测试'

  5. 检查mysql2 gem gem list mysql2

  6. 删除不是自编的gem(通过第3步),如名称mysql2-0.3.18-x86-mingw32,并确保只有编译版本的mysql2,看起来像mysql2-0.3.18

  7. 完成!

我希望对你有帮助。


I am making one application using RoR with mysql.I followed the below steps for making app with mysql.

1-rails new projectname -d mysql

2-rails generate scaffold Post title:string body:text

After running the 2nd step I got the following error.

Error:

Failed to load libmysql.dll from C:\Ruby193\lib\ruby\gems\1.9.1\gems\mysql2-0.3.
18-x86-mingw32\vendor\libmysql.dll

I have installed mysql in my system and copied the libmysql.dll file from mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to C:\Ruby193\bin still i am getting the above error.Please try to help me to resolve this error and i am also interested to know if my mysql DB is present in some other instance instead of my local system how can i connect it using Rails.

I am using Rails version-3.2.19 and win-xp in my system.

解决方案

After some "Google Work" and try on a Win2k3 Server, it seems like a problem case by "binary version of mysql2".

In recent versions of mysql2, it contains libmysql.dll unlike before it need to compile locally, and the version of libmysql.dll comes from MySQL Connector 6.1.x which remove WinXp/2k3's support.

So, you can try this way i have success in my Redmine installation:

  1. Uninstall your mysql2 gem by gem uninstall mysql2 and remove all mysql2 package
  2. Download a "MySQL Connector/C NoInstall" from MySQL which version should lower than 6.1, in my case is 6.0.2(mysql-connector-c-noinstall-6.0.2-win32.zip), and unzip to a path, such like "D:\MySQLConn"
  3. Install mysql2 by this command:gem install mysql2 --platform=ruby -- '--with-mysql-lib="D:\MySQLConn\lib" --with-mysql-include="D:\MySQLConn\include"'
  4. Run Redmine's install `bundle install --without development test'
  5. Check mysql2 gem gem list mysql2
  6. Remove the gem which not "self-compiled"(by step 3), like name "mysql2-0.3.18-x86-mingw32" and make sure there only a "self-compiled" version of mysql2, looks like "mysql2-0.3.18"
  7. Done!

I hope it will helpful for you.

这篇关于无法使用Ruby on Rails 3加载libmysql.dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 23:52