# Installing mysql for ruby purposes (windows)

**URL:** <https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627>\
**Category:** Ruby\
**Created:** [May 4, 2006, 8:27pm UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627 "2006-05-04T20:27:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfsog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Post date:** [May 4, 2006, 8:27pm UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627/1 "2006-05-04T20:27:26Z")

</div>

I have Ruby version 1.8.4 on XP SP 2.

I installed Mysql Server 5.0.2 - this worked fine.

I then tried some code like

require “mysql”

That code failed, I searched and found I have to run extconf.rb

My question is, according to [http://www.tmtm.org/en/mysql/ruby/](http://www.tmtm.org/en/mysql/ruby/) I need  
to add a path to the end of extconf.rb, such as

ruby extconf.rb --with-mysql-dir=/usr/local/mysql

I have ruby installed at c:\ruby  
And mysql installed at c:\program files\mysql

What will be the path?

Totally lost here,

Thanks.

---

<div class="post-metadata">

**Author:** ![bfsog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Post date:** [May 4, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627/2 "2006-05-04T21:41:40Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Andrew B. wrote:

> My question is, according to [MySQL/Ruby](http://www.tmtm.org/en/mysql/ruby/) I need  
> to add a path to the end of extconf.rb, such as
> 
> ruby extconf.rb --with-mysql-dir=/usr/local/mysql
> 
> I have ruby installed at c:\ruby  
> And mysql installed at c:\program files\mysql
> 
> What will be the path?
> 
> Totally lost here,

```
http://www.tmtm.org/en/mysql/ruby/

```

The above link points to a ruby extension for mysql that is written in  
C. It has to be compiled. Compiling it on windows is a real  
pain. The “ruby extconf.rb …” command is used to start compiling the  
extension.

[MySQL/Ruby](http://www.tmtm.org/en/mysql/ruby/)

This link is the pure-ruby version of the driver. It doesn’t need to  
compiled. The easiest way to get this is probably by typing  
at a command prompt:

gem install mysql

You should be able to test this by opening a command prompt and typing  
“irb” and hitting enter. Then try:

require ‘mysql’  
Mysql.client\_info

If that errors and you did the “gem install mysql” previously then try:

require ‘rubygems’  
require ‘mysql’  
Mysql.client\_info

HTH,

Zach

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.1 (GNU/Linux)  
Comment: Using GnuPG with Thunderbird - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iD8DBQFEWlh/Myx0fW1d8G0RAgn+AJ0RuIIPMZbYWgwjgLaWanM/m1J0YQCcC2uM  
gZAmaFSqe6qAM9k1dfCZ8gw=  
=l7fE  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![bfsog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Post date:** [May 4, 2006, 10:16pm UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627/3 "2006-05-04T22:16:26Z")

</div>

> The above link points to a ruby extension for mysql that is written in  
> C. It has to be compiled. Compiling it on windows is a real  
> pain. The “ruby extconf.rb …” command is used to start compiling the  
> extension.
> 
> [MySQL/Ruby](http://www.tmtm.org/en/mysql/ruby/)

The ruby for apache project has a precompiled version included.

[http://rubyforge.org/frs/?group\_id=477&release\_id=2501](http://rubyforge.org/frs/?group_id=477&release_id=2501)

Run the installer only select the mysql part

I’m not sure who’s but this is but you have to make sure that the  
msql\bin entry in your path environment variable is set and if it’s the  
last entry it must have a semi colon at the end otherwise somethings not  
finding it.

---

<div class="post-metadata">

**Author:** ![bfsog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Post date:** [May 5, 2006, 12:12am UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627/4 "2006-05-05T00:12:05Z")

</div>

> [MySQL/Ruby](http://www.tmtm.org/en/mysql/ruby/)
> 
> This link is the pure-ruby version of the driver. It doesn’t need to  
> compiled. The easiest way to get this is probably by typing  
> at a command prompt:
> 
> gem install mysql
> 
> You should be able to test this by opening a command prompt and typing  
> “irb” and hitting enter. Then try:
> 
> require ‘mysql’  
> Mysql.client\_info
> 
> If that errors and you did the “gem install mysql” previously then try:
> 
> require ‘rubygems’  
> require ‘mysql’  
> Mysql.client\_info
> 
> HTH,
> 
> Zach

Ok, I’m having the same problem getting mysql to work with ruby. I  
tried your approach. When I entered gem install mysql I get a few  
options. I chose the second option “mysql 2.7 (ruby)” and got the  
following error:

Failed to gem native extension

As expected, both test options failed. When I tried require ‘rubygems’  
in irb it returned false. I also saw the message concerning the  
rubyapache download but am not sure what apache is. Any thoughts?

Jon

---

<div class="post-metadata">

**Author:** ![bfsog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Post date:** [May 11, 2006, 1:17pm UTC](https://www.ruby-forum.com/t/installing-mysql-for-ruby-purposes-windows/59627/5 "2006-05-11T13:17:27Z")

</div>

Andrew B. wrote:

> I then tried some code like
> 
> require “mysql”
> 
> That code failed, I searched and found I have to run extconf.rb

hi i also had issues with ruby/mysql, if ruby and mysql are working  
independantly but don’t talk to each other, you might want to check this  
out:[http://www.ruby-forum.com/topic/8061#3353](http://www.ruby-forum.com/topic/8061#3353)

check this out to read article i started when i was having my mysql  
problems:  
[http://www.ruby-forum.com/topic/61253#63952](http://www.ruby-forum.com/topic/61253#63952)

i personally never installed any C code modules and i never ran  
extconf.rb - this may be what you are looking for, however i’m still  
hoping to find out why this solved my problems(if there are any people  
out there who might know’maybe it’s cos i never ran etconf.rb, i’m not  
willing to find out though’)

good luck
