Installing mysql for ruby purposes (windows)

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/ 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.

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

Andrew B. wrote:

My question is, according to 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

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

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

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

The ruby for apache project has a precompiled version included.

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.

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

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

check this out to read article i started when i was having my mysql
problems:
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