Search code examples
mysqlruby-on-railsrubyrubymine

LoadError trying to use MySQL with Ruby on Rails in Windows, RubyMine IDE


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!


Solution

  • 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.