cannot load such file -- mysql/mysql_api (LoadError) - mysql

I get this error while using rails server
C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:6:in `require': cannot load such file -- mysql/mysql_api (LoadError)
from C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:6:in `rescue in <top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
from E:/ruby/config/application.rb:7:in `<top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from E:/ruby/bin/rails:4:in `require'
from E:/ruby/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
I installed mysql by downloading the mysql-controller-c ,but it still reports me an error, and l copied libmysql.dll to ruby/bin ,also I copied it to system32,and it still have the problem,can someone give me a suggestion to solve it.

This gem does not have prebuilt native extension for Ruby-2.0 (see C:\Ruby\lib\ruby\gems\2.0.0\gems\mysql-2.9.1-x86-mingw32\lib\mysql). You will have to build it yourself or downgrade to ruby-1.9.

Related

Error while starting my Rails server [duplicate]

Today i installed ruby and rails gems everthing got success
but after when i tried to start server using command rails server i get some error it is being listed below please help me
C:\Ruby200-x64\project>rails server
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `requir
e': 193: %1 is not a valid Win32 application. - C:/Ruby200-x64/lib/ruby/gems/2
.0.0/gems/mysql2-0.3.13/lib/mysql2/mysql2.so (LoadError)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2.rb
:8:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:72:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:72:in `block (2 levels) in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:70:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:70:in `block in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:59:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/r
untime.rb:59:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.r
b:132:in `require'
from C:/Ruby200-x64/project/config/application.rb:7:in `<top (required)>
'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/co
mmands.rb:76:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/co
mmands.rb:76:in `block in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/co
mmands.rb:73:in `tap'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/co
mmands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Try to execute
rake db:create
command to create database and paste the errors if any. There we can find meaningful error message

Problems with redmine installing step 5. rake generate_secret_token

I'm trying to install Redmine on my fedora machine and I have been following the official wiki to install it, I have gotten up to step 5 when I am asked to run the
*rake generate_secret_token*
command, however when I do I get this error
rake aborted!
cannot load such file -- mysql2/mysql2
/home/usera/redmine-2.3/config/application.rb:7:in `<top (required)>'
/home/usera/redmine-2.3/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
with --trace
rake aborted!
cannot load such file -- mysql2/mysql2
/usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require'
/usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/usr/local/share/gems/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/home/usera/redmine-2.3/config/application.rb:7:in `<top (required)>'
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
/home/usera/redmine-2.3/Rakefile:5:in `<top (required)>'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/share/gems/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/bin/rake:23:in `load'
/bin/rake:23:in `<main>'
I am running the command as root. This is the guide I used http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Do you have installed the necessary native libraries for mysql2 adaptor ?
You can check:
mysql2 adapter issues in installing Redmine on Fedora 17

Can't launch server on rails (LoadError)

I can't launch server on rails.
I uninstalled and re-installed both mysql and mysql gem.
But still I get the same error
This is what i get
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.0/mysql2 (LoadError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from G:/Surath/Sites/simple_cms2/config/application.rb:7:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Rails server error when copying LIMMYSQL.dll from MySql to Ruby bin folder

I copy LIMMYSQL.dll from MySql and put it in Ruby bin folder and then start rails server and I am getting below error. Please help me
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require': 193: %1 is not a valid Win32
application. - c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
from d:/merlin_demo_app/demo_app/config/application.rb:7:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:53:in `block in <top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have solved this, eventually!
I re-installed Ruby and Rails under RVM. I'm using Ruby version 1.9.2-p136.
After re-installing under rvm, this error was still present.
In the end the magic command that solved it was:

Sequel::AdapterNotFound while trying to run Ruby On Rails application

I'm trying to get a project going on my system. I imported the source code via GITHub, and am running it locally with WEBrick. When I do, the following error is printed:
=> Booting WEBrick
=> Rails 2.3.8 application starting on 0.0.0.0:3000
<internal:lib/rubygems/custom_require>:29:in `require': LoadError: 126: Det går inte att hitta den angivna modulen(*Translation: Cannot find the given module*.) - C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so (Sequel::AdapterNotFound)
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
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 <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/adapters/mysql.rb:4:in `rescue in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/adapters/mysql.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/core.rb:249:in `block in tsk_require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/core.rb:72:in `block in check_requiring_thread'
from <internal:prelude>:10:in `synchronize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/core.rb:69:in `check_requiring_thread'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/core.rb:249:in `tsk_require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/database/connecting.rb:23:in `adapter_class'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/database/connecting.rb:61:in `connect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.15.0/lib/sequel/core.rb:119:in `connect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails_sequel-0.2.1/lib/rails_sequel/rails_sequel.rb:5:in `connect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails_sequel-0.2.1/lib/rails_sequel.rb:8:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/initializer.rb:307:in `block in load_gems'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/initializer.rb:164:in `process'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
from C:/Users/Soroush/AppData/Local/VirtualStore/Program Files/Git/foobar/projectxt/config/environment.rb:9:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/commands/server.rb:84:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/server:3:in `<main>'
I Googled on "Sequel::AdapterNotFound", "LoadError126", "mysql_api.so" but can't seem to get any valuable information.
I found this page: http://permalink.gmane.org/gmane.comp.lang.ruby.sequel/2645
where someone seems to have a similar problem, with a reply asking if running irb -rubygems -rmysql returns an error. I did that, and it gave me an error that said that LIBMYSQL.dll was missing on the computer. I'm not sure if this is any useful, but thought I'd mention it here.
Does anyone have a clue to a solution to the problem, or a direction for me to look in?
The important part is here:
LoadError: 126: Det går inte att hitta den angivna modulen(*Translation: Cannot find the given module*.) - C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so
The error is being raised by the Ruby MySQL gem, which you confirmed by running that IRB command. You probably need to add the LIBMYSQL.dll file to the computer, like it said.