# MySQL Installation Issues

**URL:** <https://www.ruby-forum.com/t/mysql-installation-issues/121662>\
**Category:** Rails\
**Created:** [November 29, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662 "2007-11-29T18:33:13Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [February 8, 2010, 3:34pm UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/21 "2010-02-08T15:34:29Z")

</div>

Kirk Howard wrote:

> Whenever you can’t build “native extensions”, it means there is some lib  
> or lib-dev missing. Generally you’ll need to do a sudo apt-get install  
> lib-???-dev, or sudo apt-get install build\_essential.
> 
> This time, I had to install the following:  
> ‘sudo apt-get install libmysqlclient15-dev’

Thanx this worked well tho the ri docs did not install (I think)

Terminal output:

Successfully installed mysql-2.8.1  
1 gem installed  
Installing ri documentation for mysql-2.8.1…

No definition for next\_result

No definition for field\_name

No definition for field\_table

…

etc etc

Does this mean another file is missing and is not having ri docs any big  
deal?

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [March 21, 2010, 9:58am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/22 "2010-03-21T09:58:56Z")

</div>

On 21 March 2010 00:48, Mike M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Just starting my first Ruby project… and not so comfortable with this  
> install of the mysql gem. I expect there’s possibly serious  
> ramifications of excluding these two processes. Can anybody tell us what  
> are we missing by resorting to these install parameters; and/or how can  
> we install with ri and rdoc successfully?

ri and rdoc are just for documentation of the gem. Google them to  
find details. Not having them will not affect the operation of the  
gem.

Colin

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [June 16, 2010, 8:21am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/23 "2010-06-16T08:21:33Z")

</div>

Mike M. wrote:

> Abraham Tio wrote:
> 
> > > cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7  
> > > gem install mysql –  
> > > –with-mysql-config=/usr/local/mysql/bin/mysql\_config  
> > > Greg D.  
> > > [http://destiney.com/](http://destiney.com/)
> > 
> > YUP. this works.
> 
> newbie question…
> 
> I was able to get an error free install on OSX Leopard 10.6.2 with the  
> following. The first cds to the mysql gem location of my Leopard install  
> (may differ for others):
> 
> cd /Library/Ruby/Gems/1.8/gems/mysql-2.8.1  
> sudo gem install mysql --no-rdoc --no-ri –  
> –with-mysql-config=/usr/local/mysql/bin/mysql\_config
> 
> There were many “No definition for…” RDoc and Ri errors otherwise.
> 
> Just starting my first Ruby project… and not so comfortable with this  
> install of the mysql gem. I expect there’s possibly serious  
> ramifications of excluding these two processes. Can anybody tell us what  
> are we missing by resorting to these install parameters; and/or how can  
> we install with ri and rdoc successfully?
> 
> tia
> 
> m  
> Yay!  
> After much irc and googling, at last, I found your recent entry Mike and  
> I also was able to get an error free install on OS X 10.6.3  
> with  
> $ sudo gem install mysql --no-rdoc --no-ri –  
> –with-mysql-config=/usr/local/mysql/bin/mysql\_config

TX!  
huuan

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [March 21, 2010, 7:42pm UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/24 "2010-03-21T19:42:13Z")

</div>

Colin L. wrote:

> ri and rdoc are just for documentation of the gem. Google them to  
> find details. Not having them will not affect the operation of the  
> gem.
> 
> Colin

Thanks Colin. I quickly found that out. I’ve posted instructions for  
resolving this issue at MySQL:

> **[MySQL :: Comprehensive Instructions (?) : CORRECTLY Installing AND...](https://forums.mysql.com/read.php?116,359591,359591)**

The described process determines vital paths for successful installation  
on potentially any system.

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [May 30, 2011, 7:47am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/25 "2011-05-30T07:47:19Z")

</div>

Kirk Howard wrote in post #840950:

> Whenever you can’t build “native extensions”, it means there is some lib  
> or lib-dev missing. Generally you’ll need to do a sudo apt-get install  
> lib-???-dev, or sudo apt-get install build\_essential.
> 
> This time, I had to install the following:  
> ‘sudo apt-get install libmysqlclient15-dev’
> 
> Unfortunately, there is NO EASY WAY (that I know of) to identify what is  
> missing from the attempt to compile.

Excellent. This worked for me!  
I did it and  
sudo gem install mysql2

Successful 🙂  
Thanks

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [March 30, 2011, 2:18pm UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/26 "2011-03-30T14:18:14Z")

</div>

apt-get install libmysqld-dev

will be ok .

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [June 27, 2011, 10:46am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/27 "2011-06-27T10:46:19Z")

</div>

This worked for me too, Ubuntu 11.04 desktop.

William P. wrote in post #595050:

> It’s very possible that it is looking for libmysqlclient (I am almost  
> positive it does). Install the client / client libs and see if that  
> solves your problem.
> 
> -Bill
> 
> pete wrote:
> 
> > >

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [July 9, 2011, 10:56am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/28 "2011-07-09T10:56:33Z")

</div>

bill gate wrote in post #989948:

> apt-get install libmysqld-dev
> 
> will be ok .

Excellent !! it works for me on ubuntu 9.10,

sudo apt-get install libmysqld-dev

(installation process … )

sudo gem install mysql

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [January 13, 2012, 3:42am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/29 "2012-01-13T03:42:24Z")

</div>

Wainer Moschetta wrote in post #773714:

> I was facing this same issue. I just installed libmysqlclient15-dev on  
> my syste (ubuntu 8.10) and could get gem mysql installed successfully
> 
> William P. wrote:
> 
> > It’s very possible that it is looking for libmysqlclient (I am almost  
> > positive it does). Install the client / client libs and see if that  
> > solves your problem.
> > 
> > -Bill

thanks. I installed libmysqlclient16-dev, everything worked.

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [August 29, 2012, 11:30am UTC](https://www.ruby-forum.com/t/mysql-installation-issues/121662/30 "2012-08-29T11:30:48Z")

</div>

This is an old thread, but if you google the error message, it appears  
first in the list of results, so it’s worth writing a summary.

The root of the problem is that to install the mysql gem you need to  
compile some native code. (“Native code” is software written in a  
language such as C or C++ which needs to be compiled specifically for  
the processor that your computer uses - 64-bit Intel x86 or whatever.)

Actually, it’s worth noting that this applies to EVERY DATABASE GEM -  
postgres, firebird or whatever. Mysql is just the most popular.

As far as I can see, the reason that the first solution given in this  
thread doesn’t work for some people is that it depends upon the method  
that you use to install mysql. On my Ubuntu Linux system, I installed  
mysql like this:

```
sudo apt-get install mysql-server mysql-client

```

This installs mysql, but it doesn’t create a directory  
/usr/local/mysql/bin/mysql\_config. The first solution expects  
that directory to exist.

The second solution is to install the mysql development library, which I  
did:

```
sudo apt-get install libmysqld-dev

```

and then I could install the mysql gem:

```
gem install mysql2

```

So the first solution didn’t work for me but the second one did.  
However, for you it may be different.

It’s also worth saying that I’ve installed mysql and Rails on a Windows  
PC and I didn’t get this problem. It all depends on the environment you  
are using, the version of rails and the method used to install mysql.

This may not be under your control. Last year I tried to get my app  
working on a shared managed host that supported Ruby on Rails. They had  
just upgraded from Rails 2 to Rails 3. It being a manged host, they  
installed all the base software and when I hit this problem I couldn’t  
get past it. I wasted hours and got through several hosting companies  
before I switched to a Virtual Private Server (VPS) where I have root  
access and install everything myself. I got the problem again, but this  
time I was able to get to the bottom of it.

If you working with a Linux host, this command may be useful:

```
find / -name "libmysqlclient.*" 2>/dev/null

```

It searches through your file system starting at the root looking for  
libmysqlclient. On my system it produces:

```
/usr/lib/libmysqlclient.a
/usr/lib/libmysqlclient.so.16
/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.16.0.0
```

[Previous page](https://www.ruby-forum.com/t/mysql-installation-issues/121662.md?page=1)
