Thursday, March 31, 2011

Getting error: The specified module could not be found. - C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so (LoadError )

After installing pik, added Ruby 1.9.2 and then switched to Ruby 1.9.2, installed rails on Ruby 1.9.2.
On my existing rails application which has already been updated to Rails -v 3.0.3, I ran 'bundle install' and it executed and installed the gems. Tried to run rails server, but got error:


>rails s
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `require': 126: The specified module could not be found.   - C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so (LoadError
)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `rescue in <top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `block in require'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
        from C:/projects/working project/phoenix/config/application.rb:7:in `<top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in <top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

To fix this error, I copied "libmySQL.dll" file from 'C:\Program Files\MySQL\MySQL Server 5.1\bin' to 'C:\Ruby192\bin' and then on starting the server it ran without any error.

3 comments:

  1. Hello Ritesh!

    I have an exact error, but copying file don't solve this problem for me, please help!

    I'm on Windows7/x64 machine with ruby-1.9.2 and rails-3.1.0

    Thanks in advance!

    ReplyDelete
  2. Hurray! My problem is resolved!
    You must use only 32bit libmySQL.dll for now!
    Follow this link to read more detailed answer: http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it

    ReplyDelete
  3. I got this error after doing the above one
    Incorrect MySQL client library version! This gem was compiled for 6.1.3 but the
    client library is 5.5.27. (RuntimeError)

    ReplyDelete