mysql2 gem for windows error

By  installing  Development Kit and MySql Connector:

To install Development Kit:

1. Left double-click the self-extracting executable (SFX)  to install the DevKit artifacts into. For example, C:DevKit.


3. ruby dk.rb init to generate the config.yml. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present).

4. edit the generated config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with.

5. [optional] ruby dk.rb review to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.

6 .Finally, ruby dk.rb install to DevKit enhance your installed Rubies. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into <RUBY_INSTALL_DIR>librubysite_ruby


To install MySQL Connector/C:

1. Download MySQL Connector/C (

2. install it.

3. When installing mysql2 gem, provide the additional options (gem install mysql2 -v 0.2.10 — –with-mysql-include=”…” –with-mysql-lib=”…”)Provide for –with-mysql-include option the path to the includedirectory of MySQL Connector/C. The same for –with-mysql-lib but this time point to lib directory.

eg:  cmd> gem install mysql2 — ‘–with-mysql-lib=”C:Program FilesMySQLMySQL Connector C 6.0.2libopt” –with-mysql-include=”C:Program FilesMySQLMySQL Connector C 6.0.2include”‘

Permanent link to this article:

Leave a Reply

Your email address will not be published.