LoadError 尝试在 Windows、RubyMine IDE 中将 MySQL 与 Ruby on Rails 一起使用
当尝试从 RubyMine 运行简单的 Ruby on Rails 应用程序时,我收到以下错误:
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)
问题是,该文件实际上在那里。此外,我还运行了“bundle install”,将 mysql 与项目关联起来,以及我能找到的所有其他内容。网上有一些建议认为 libmysql.dll 需要位于特定目录中 - 但没有指示获取该特定文件。
有谁知道如何解决这个问题?谢谢!
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)
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我通过将 libmysql.dll 复制到“bin”目录来修复类似的错误。在您的情况下,将 libmysql.dll 复制到 C:\Ruby192\bin
libmysql.dll 在您安装 MySql 时安装。文件的位置取决于您使用的是 WAMP、XAMPP 还是仅使用 MySql。如果你找不到它,请在你的计算机上搜索它,当然我在这里假设你已经安装了 MySql 并且它正在运行。
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 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.
谢谢,我能够修复错误。为了修复此错误,我将“libmySQL.dll”文件从“C:\Program Files\MySQL\MySQL Server 5.1\bin”复制到“C:\Ruby192\bin”。有关详细信息,请参阅帖子 - http://rorguide。 blogspot.com/2011/03/getting-error-specified-module-could.html
Thanks, I was able to fix the error. To fix this error, I copied "libmySQL.dll" file from 'C:\Program Files\MySQL\MySQL Server 5.1\bin' to 'C:\Ruby192\bin'. For details, refer to post - http://rorguide.blogspot.com/2011/03/getting-error-specified-module-could.html
我从这里复制了
libmysql.dll
mysql-connector-c-6.1.5-win32.zip\mysql-connector-c-6.1.5-win32\lib
< a href="http://dev.mysql.com/downloads/connector/c/" rel="nofollow">http://dev.mysql.com/downloads/connector/c/ 到 ruby bin使其工作的目录I copied
libmysql.dll
frommysql-connector-c-6.1.5-win32.zip\mysql-connector-c-6.1.5-win32\lib
from here http://dev.mysql.com/downloads/connector/c/ to ruby bin directory to make it working如何使用 mysql (wamp) 在 Windows 计算机上安装 ruby on Rails
使用这些命令解决 https 证书问题 (来源)
安装gem并定位mysql lib文件
现在,当您创建应用程序时,请使用以下命令:
当您尝试使用命令rails server 实例化服务器时,它会给您大量 mysql 错误,但不要不用担心,还有一个步骤可以解决这个问题:
进入mysql的lib目录:
C:\wamp\bin\mysql\mysql5.6.17\lib
复制 libmysql.dll 并将其粘贴到 ruby 的 bin 文件夹中,在我的例子中,它是 C:\RailsInstaller\Ruby2.1.0\bin
我希望一切顺利工作正常。
How to install ruby on rails on windows machine with mysql (wamp)
solve the https certificate issue by using these commands (source)
make sure that you have ruby installed for i386 not x64 bit, same goes for the wamp as well.
install the gem locating the mysql lib file
Now, when you create your app, use the following command:
When you will try to instantiate the server by using the command rails server, it will give you tonnes of mysql errors, but don't worry there is one more step which can solve it:
go to the lib directory of mysql:
C:\wamp\bin\mysql\mysql5.6.17\lib
copy the
libmysql.dll
and paste it into the bin folder of your ruby, in my case, it isC:\RailsInstaller\Ruby2.1.0\bin
I hope everything will work fine.