Rails中使用MySQL的LoadError

Rails中使用MySQL的LoadError

本文介绍了尝试在Windows,RubyMine IDE的Ruby on Rails中使用MySQL的LoadError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从RubyMine运行简单的Ruby on Rails应用程序时出现以下错误:

I am getting the following error when trying to run a simple Ruby on Rails application from RubyMine:

C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': 126: The specified module could not be found.
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)

问题是,该文件实际上在那里.此外,我已经运行了捆绑安装",将mysql与项目相关联,以及其他所有我能找到的东西.网上有人建议libmysql.dll必须位于特定目录中-但没有迹象表明可以获取该特定文件.

The thing is, that file is actually there. Further, I've run 'bundle install', associated the mysql with the project, and everything else I can find. There is some suggestion on the net that libmysql.dll needs to be in a particular directory - but no indication to get that particular file.

有人知道如何解决此问题吗?谢谢!

Does anyone know how to fix this problem? Thanks!

推荐答案

我通过将libmysql.dll复制到"bin"目录中来修复了类似的错误.在您的情况下,将libmysql.dll复制到C:\ Ruby192 \ bin

I fixed a similar error by copying libmysql.dll to the "bin" directory. In your case copy libmysql.dll to C:\Ruby192\bin

libmysql.dll.文件的位置取决于您使用的是WAMP,XAMPP还是MySql.如果找不到它,请在您的计算机上搜索它,当然,这里我假设您已经安装了MySql并且它正在运行.

libmysql.dll gets installed when you intall MySql. The location of the file depends on whether you are using WAMP, XAMPP or just MySql. If you can't locate it search for it on your computer, ofcourse I assume here that you have MySql installed and that its running.

这篇关于尝试在Windows,RubyMine IDE的Ruby on Rails中使用MySQL的LoadError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:20