Fresh Ruby on Rails Install on Windows: MSQL Gem Not Working

139 views Asked by At

I need to install Ruby on Windows in order to access the project I am going to work on. I followed the instructions here on installing it but when I get to write the scaffolding (12:50), I get the error below.

Note: I did the instructions as mentioned in the video. The only difference is that instead of installing a dedicated MySQL in my computer, I am using the MySQL I have on my XAMPP installation.

C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/mysql2.rb:31:in `require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/mysql2.rb:31:in `<top (required)>'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:76:in `require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:72:in `each'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:72:in `block in require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:61:in `each'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:61:in `require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.3/lib/bundler.rb:134:in `require'
    from C:/row/dev/hello_world/config/application.rb:7:in `<top (required)>'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:141:in `require'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:128:in `generate_or_destroy'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:50:in `generate'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Any advise on how to diagnose this?

1

There are 1 answers

0
rick On

Follow this steps,

or you can use this shroter,

gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"

Let me know if this will solve your problem.