Question

Windows 7 32bits

Hi everyone, how can I install mysql2 properly in windows 7 I have this error:

    c:\dev\mysql2>gem install mysql2-0.3.13.gem --no-ri --no-rdoc -- --with-mysql-di r=c:\mysql-connector-c-noinstall-6.0.2-win32

This could take a while...
ERROR:  Error installing mysql2-0.3.13.gem:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb --with-mysql-dir=c:\mysql-connector-c-noi
nstall-6.0.2-win32

Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g
em_make.out

c:\dev\mysql2>

Was it helpful?

Solution

Try to install using different version, It's happens because sometime binary is not available for specific verion for window.

gem install mysql2 -v 0.2.6

If still you have issues, Try below steps.

1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/

NOTE Don't download the installer, download the ARCHIVE for your OS

2) Extract the file to C:\mysql-connector

3) Then ran:

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

It's works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top