0

I am new to this so please be lenient if I am not asking in a good way. I have seen some similar questions such as: Can't start rails server mysql2 gem? however I have not been able to solve this problem through their answers.

I am trying to start a ruby on rails server, I have installed MySQL, ruby, rails, and the gems successfully. I have also installed the sql2 gem successfully. I have created a project and changed to its directory. When I type:

rails server

to create a server, I get the following message in the terminal:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in 'require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)

followed by a lot more text but I believe this line is the root of the problem.

This is what is in the mysql2.rb file:

RUBY_VERSION =~ /(\d+.\d+)/ require "mysql2/#{$1}/mysql2"

In the error it says it cannot load mysql2/2.2/mysql2, when I navigate to the mysql2 folder, there is only a 2.0 and a 2.1 folder, no 2.2 folder. Is this the problem? If so do you know how I fix it?

Community
  • 1
  • 1
rbncruise
  • 21
  • 2

1 Answers1

0

Change require "mysql2/#{$1}/mysql2" to require "mysql2/2.1/mysql2" in your mysql2.rb file, I think the issue is that it's looking for the version that doesn't exist, give that a try and get back to us if it doesn't work.

Regards, Grant

Grant
  • 446
  • 6
  • 24
  • Ok so I did what you said there and I get the following message: **C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in 'require':126: The specified module could not be found.** - **C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/2.1/mysql2.so (LoadError)** – rbncruise Jun 02 '15 at 15:10