# Installing mySql GEM on Ubuntu?

**URL:** <https://www.ruby-forum.com/t/installing-mysql-gem-on-ubuntu/108177>\
**Category:** Ruby\
**Created:** [June 29, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/installing-mysql-gem-on-ubuntu/108177 "2007-06-29T19:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [June 29, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/installing-mysql-gem-on-ubuntu/108177/1 "2007-06-29T19:55:58Z")

</div>

I am running Linx Mint, a version of Ubuntu, and I installed Ruby  
and Rails. However, when I try to install the mySql package via. gem,  
“gem  
install mysql” I get an error message (See below) with no idea how to  
fix  
the error. I looked on the net (Google), but all suggestions do not  
work  
with this Linux.

Also, as far as I know, I have all of the correct mySql drivers/headers,  
etc.

=================== error message ==================================

Select which gem to install for your platform (i486-linux)

1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. mysql 2.5.1 (ruby)
6. Cancel installation

> 3  
> Building native extensions. This could take a while…  
> extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)  
> from extconf.rb:1

ERROR: While executing gem … (RuntimeError)  
ERROR: Failed to build gem native extension.  
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7  
for inspection.

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [July 1, 2007, 12:00am UTC](https://www.ruby-forum.com/t/installing-mysql-gem-on-ubuntu/108177/2 "2007-07-01T00:00:20Z")

</div>

On 6/29/07, David [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> from extconf.rb:1
> 
> ```
> 
> ERROR: While executing gem … (RuntimeError)  
> ERROR: Failed to build gem native extension.  
> Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

[http://blogs.law.harvard.edu/hoanga/2006/10/27/fixing-mkmf-load-error-ruby-in-ubuntu/](http://blogs.law.harvard.edu/hoanga/2006/10/27/fixing-mkmf-load-error-ruby-in-ubuntu/)

apt-get install ruby-dev

If that doesn’t help, tell us how did you install ruby (from package  
or from source), and whether you have installed build-essential  
package (i.e. can you compile anything?)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [July 1, 2007, 7:53am UTC](https://www.ruby-forum.com/t/installing-mysql-gem-on-ubuntu/108177/3 "2007-07-01T07:53:49Z")

</div>

Try:

sudo apt-get install libmysql-ruby

This will install the distribution’s MySQL library. It works well in  
production, I’ve used it many times in both server and development  
environments.

Robert
