If you’re getting this error, install the mysql gem by executing the following command:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

This worked for me, and I’m using Mac OS X 10.5.6, Rails 2.2.2, and MySQL 5.0.67.

15 Comments

louis

That doesnt work for me…

I use XAMPP on MacOSX and now i have to install this gem but i always get an error messages. :S

Jeff

@louis, what is the error that you are getting?

louis

Ls-MacBook:~ Ls$ sudo gem install mysql — –with-mysql-config=/Applications/xampp/xamppfiles/bin/mysql_config

Building native extensions.
This could take a while…

ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql — –with-mysql-config=/Applications/xampp/xamppfiles/bin/mysql_config
checking for mysql_ssl_set()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
–with-mysql-config

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out

Ivan Soto

Same error here… Ubuntu 8.04

Olle

Same error here…. GNU/Linux

Niyas

I am using Debian and i got the same error..

paparao

install libmysql-ruby

elzr

Thanks! This worked perfectly for me.
I had tried different permutations of parameters (sudo gem install mysql — –with-mysql-dir= /usr/local/mysql OR sudo gem install mysql — –with-mysql-include=/usr/local/mysql/include/ –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql config=/usr/local/mysql/bin/mysql_config) but only until I hit on yours did it worked.

I’m on Mac OS 10.6.2, Rails 2.3.4, MySQL 5.1.4

Thanks!

benja

thanks elzr.
This works for me:
install libmysql-ruby

Carlos Aldas

Same error here… Windows 7 with Netbeans 6.5

help!!!!

Max

Hey,

having the same error on OS X 10.6 but when I type “install libmysql-ruby” I am getting:

usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 … fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory …

What do I make wrong?

joeblogg

Same issue here.

Trying to install netbeans ide 6.8 to work with bitnami ruby stack 2.0-1. Have tried the older libmysql.dll library (from instantrails) and load in the gem – but issue appearing for that version of the dll (2.7.3) as well. Anyone any ideas?
ta.

tkdudine

Same error as MAX.
I can not find solutions to install mysql.rb on bitnami redmine 0.9.2 stack

I’m using Mac OSX 10.6.2

Chris

I am having a similar problem on Ubuntu 9.10. When I enter the above I get:

ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb –with-mysql-config=/usr/local/mysql/bin/mysql_config
extconf.rb:10:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:10

Todd Cesere

This is happening to me *after* I successfully install mysql.