Tuesday, October 8, 2013

rails mysql2 install fail

if you encounter No such method for Nil Class,
its due to a bug in mysql2 v0.3.13,

so try to install
gem install mysql2 -v 0.3.11

to get it installed on windows, you will need the right connector library to be installed.
first, download the zip file of the mysql connector, and extract it.
v0.3.11 requires mysql-connector-c-noinstall-6.0.2-win32

next, install using this command:
gem install mysql2 -v 0.3.11 --platform=ruby -- --with-opt-dir="C:\path-to\mysql-connector-c-noinstall-6.0.2-win32"

after installed, makesure to copy C:\path-to\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to c:\Ruby200\bin\

Note: nokogiri currently desnt support ruby 64bits.
so try to use 32bits if you need to use it.

No comments: