1

I am trying to run rails server command but it showing mysql2 Load Error. I will place my Error log here Error Log

I searched many places. I tried to install from my bundle itself using "gem install mysql2 --ruby=platform" command using connector c "libmysql.dll" file pasted in ruby/bin but no use.

I actually have MySQL installed on my system long back when I was doing JDBC connections. Its SQL server version 5.0- Is that version causing this error? Or Do I need to uninstall the MySQL from my system and install Latest Version! And a doubt for me is how is this MySQL Server 5.0 connected to Rails as I no I have no idea about it, because while installation I used Connector C 6.1 for mysql2 installation from the Command Promt!

I tried Ruby on Rails - cannot load such file -- mysql2/2.2/mysql2 (LoadError)

I also tried Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0 But I am getting the same error.

I think I have given all the details regarding versions and what I did! I tried doing this like 50 times but no progress! I hope I will get my problem solved !Thank You!

Community
  • 1
  • 1
mRbOneS
  • 121
  • 1
  • 14

2 Answers2

0

im not using windows. but seems to be duplicate with posts like this (Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0)

Community
  • 1
  • 1
rob
  • 2,136
  • 8
  • 29
  • 37
0

The following below instructions can help you.

gem uninstall mysql2

Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip

Extract it to C:\connector-6.0.2

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-
6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-
dir="C:\connector-6.0.2"'

Or even shorter:

gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"
Umar Khan
  • 1,381
  • 11
  • 18
  • Hai I did what you said. I downloaded rar file and extractd it to c:\connector-6.0.2 And I uninstalled mysql2 from cmd First, I pasted libmysql.dll from the connector-6.0.2\lib to the rails\bin folder Then I performed installation using the above command you gave. It installed. Now when I run the rails server command it shows some error uninitialized constant ActionView::Helpers::ActiveModelHelper (Name Error) – mRbOneS Jul 10 '15 at 12:51