How to install mysql2 gem on Windows

advertisements

I'm using DevKit and XAMPP, and now I have to execute the following command:

gem install mysql2 -v 0.2.6 --platform=ruby -- --with-mysql-dir="x:\Prog
ram Files\mysql-5.5.11-winx64" --with-mysql-lib="x:\Program Files\mysql-5.5.11-winx64\lib" --with-my
sql-include="x:\Program Files\mysql-5.5.11-winx64\include" --without-opt-dir

However, XAMPP does not include a lib or include folder on its MySQL directory. What should I specify instead ?

Thanks


Here's the solution I used to get Ruby with the MySQL2 gem running on Windows 7 using XAMPP's MySQL installation.

At the Ruby command prompt run (make sure to update the path to wherever you've got XAMPP/MySQL installed):

gem install mysql2 -- --with-mysql-dir="C:\xampp\mysql\bin"

The output from this command includes:

=========================

You've installed the binary version of mysql2. It was built using MySQL Connector/C version 6.0.2. It's recommended to use the exact same version to avoid potential issues.

At the time of building this gem, the necessary DLL files where available in the following download:

http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

And put lib\libmysql.dll file in your Ruby bin directory, for example C:\Ruby\bin

=========================

That is very important. Follow the instructions. Download the file, extract the libmysql.dll from the lib directory within the zip file. Copy said dll into the bin folder for your Ruby install. If you used RailsInstaller and selected the defaults, the directory will be something like C:\RailsInstaller\Ruby1.9.3\bin.