Installing the MySQL Driver

Hi,

I've setting up my ROR environemtn in Ubuntu linux, however, I'm having difficulties when installing the mysql driver:

# gem install mysql Building native extensions. This could take a while... ERROR: Error installing mysql:         ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb extconf.rb:10:in `require': no such file to load -- mkmf (LoadError)         from extconf.rb:10

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ mysql-2.8.1 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/ mysql_api/gem_make.out

Not sure how to deal with the last paragraph.

I googled about the error and tried the suggested gem install mysql --with-mysql-config=/usr/local/mysql/bin/ mysql_config

but did not work.

Please help!

D

You probably need to include the double-hypen if you need to pass options to the gem:

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

Darian Shimy

You can always just install the libmysql-ruby package.

apt-get install libmysql-ruby

Johan

I remember seeing this error recently when I did not install ruby1.8-dev package.

Try this -

sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

I followed instructions at - [https://help.ubuntu.com/community/RubyOnRails](https://help.ubuntu.com/community/RubyOnRails) and it always helped me.

Thanks prolific.coder, I can see the rubygems installed.

aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

Reading package lists… Done Building dependency tree Reading state information… Done Initializing package states… Done Writing extended state information… Done The following NEW packages will be installed: libopenssl-ruby libopenssl-ruby1.8{a} ruby1.8-dev 0 packages upgraded, 3 newly installed, 0 to remove and 98 not upgraded. Need to get 702kB of archives. After unpacking 2200kB will be used. Do you want to continue? [Y/n/?] y Writing extended state information… Done Get:1 http://ph.archive.ubuntu.com intrepid-updates/universe libopenssl-ruby1.8 1.8.7.72-1ubuntu0.2 [121kB] Get:2 http://ph.archive.ubuntu.com intrepid/universe libopenssl-ruby 4.2 [5008B] Get:3 http://ph.archive.ubuntu.com intrepid-updates/main ruby1.8-dev 1.8.7.72-1ubuntu0.2 [576kB] Fetched 702kB in 10s (69.0kB/s) Selecting previously deselected package libopenssl-ruby1.8. (Reading database … 27583 files and directories currently installed.) Unpacking libopenssl-ruby1.8 (from …/libopenssl-ruby1.8_1.8.7.72-1ubuntu0.2_i386.deb) … Selecting previously deselected package libopenssl-ruby. Unpacking libopenssl-ruby (from …/libopenssl-ruby_4.2_all.deb) … Selecting previously deselected package ruby1.8-dev. Unpacking ruby1.8-dev (from …/ruby1.8-dev_1.8.7.72-1ubuntu0.2_i386.deb) … Setting up libopenssl-ruby1.8 (1.8.7.72-1ubuntu0.2) … Setting up libopenssl-ruby (4.2) … Setting up ruby1.8-dev (1.8.7.72-1ubuntu0.2) … Reading package lists… Done Building dependency tree Reading state information… Done Reading extended state information Initializing package states… Done Writing extended state information… Done

gem -v

1.3.5