Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MySQL under latest one-click installer

1 view
Skip to first unread message

R. Mark Volkmann

unread,
Apr 1, 2005, 10:58:02 PM4/1/05
to
Can it really be this hard to access MySQL from Ruby running under Windows?

Several people have emailed suggestions to me, but none are as simple as
1) download file x from site y
2) unzip file x
3) run this command to install it
4) use this API to access a MySQL database

Maybe the instructions people pointed me to work find under platforms other than
Windows or with other versions of Ruby than what is in the latest one-click
installer.

Accessing MySQL seems like a very basic requirement.
Surely someone working under Windows has needed to do this.

--
R. Mark Volkmann
Partner, Object Computing, Inc.


Lothar Scholz

unread,
Apr 1, 2005, 11:14:01 PM4/1/05
to
Hello R.,

RMV> Maybe the instructions people pointed me to work find under platforms other than
RMV> Windows or with other versions of Ruby than what is in the latest one-click
RMV> installer.

RMV> Accessing MySQL seems like a very basic requirement.
RMV> Surely someone working under Windows has needed to do this.

You can use the pure ruby implementation of the mysql client. This one
works fine in a multithreaded application but is much slower. Its just
one file and a "require" statement.

I wish that the one click installer will include a lot more
binary modules in the future (as this is not well covered by
ruby-gems) and not 2 different Editors/Ide's.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

James Britt

unread,
Apr 1, 2005, 11:29:13 PM4/1/05
to
Lothar Scholz wrote:
>
> I wish that the one click installer will include a lot more
> binary modules in the future (as this is not well covered by
> ruby-gems) and not 2 different Editors/Ide's.

Indeed. It is much easier to go get an editor or IDE than it is to get
binary modules.


James

R. Mark Volkmann

unread,
Apr 1, 2005, 11:56:22 PM4/1/05
to
Quoting Lothar Scholz <mailin...@scriptolutions.com>:

> Hello R.,
>
> RMV> Maybe the instructions people pointed me to work find under platforms
> other than
> RMV> Windows or with other versions of Ruby than what is in the latest
> one-click
> RMV> installer.
>
> RMV> Accessing MySQL seems like a very basic requirement.
> RMV> Surely someone working under Windows has needed to do this.
>
> You can use the pure ruby implementation of the mysql client. This one
> works fine in a multithreaded application but is much slower. Its just
> one file and a "require" statement.

I think that will be fine for my needs.

I downloaded ruby-mysql-0.2.6.tar.gz from
http://www.tmtm.org/en/ruby/mysql/README_en.html.

I unzipped it.

I ran "ruby setup.rb" and got
/setup.rb:8:in ``': No such file or directory - mysql_config --socket
(Errno::ENOENT) from ./setup.rb:8

Line 8 contains
sock = `mysql_config --socket`.chomp

I assume mysql_config is supposed to be an executable in the bin directory of
MySQL. It's not in mine. I have version 4.0.20a of MySQL.

Any ideas why the supplied install script doesn't work?

nobu....@softhome.net

unread,
Apr 2, 2005, 12:07:20 AM4/2/05
to
Hi,

At Sat, 2 Apr 2005 13:56:22 +0900,
R. Mark Volkmann wrote in [ruby-talk:136452]:


> I downloaded ruby-mysql-0.2.6.tar.gz from
> http://www.tmtm.org/en/ruby/mysql/README_en.html.

| Setup
|
| % ruby ./setup.rb
|
| This command find MySQL's UNIX domain socket. This is not needed for system that does not have UNIX
| domain socket such as Microsoft Windows.

--
Nobu Nakada


Kirk Haines

unread,
Apr 2, 2005, 1:08:33 AM4/2/05
to
R. Mark Volkmann wrote:

> Can it really be this hard to access MySQL from Ruby running under
> Windows?
>
> Several people have emailed suggestions to me, but none are as simple as
> 1) download file x from site y
> 2) unzip file x
> 3) run this command to install it
> 4) use this API to access a MySQL database

Yes, it is. I have MySQL running _right now_ on a WinXP box, accessed
through Ruby and DBI, and it was as simple as installing the one-click Ruby
installation. Installing ruby-mysql, and then installing dbi. Simple.


Kirk Haines

Adelle Hartley

unread,
Apr 2, 2005, 5:35:19 AM4/2/05
to
Hi Mark,

> Can it really be this hard to access MySQL from Ruby running
> under Windows?
>
> Several people have emailed suggestions to me, but none are
> as simple as

I was previously able to connect to MySQL v 4.0.12 with the Ruby one-click
installer. I recently switched to MySQL v 4.1.9 and suddenly things got
difficult.

I found some instructions which said
1. install DBI
2. configure any databases that you want to access from Ruby, to use "old"
style password authentication (unencrypted).

Even following that advice, I have not been able to connect to MySQL 4.1.9
from Ruby unless the password is blank.

Adelle.


R. Mark Volkmann

unread,
Apr 2, 2005, 8:52:38 AM4/2/05
to
Quoting nobu....@softhome.net:

Just to be clear, we're talking about using what is documented at
http://www.tmtm.org/en/ruby/mysql/README_en.html, not DBI.

So based on your advice I skipped "ruby setup.rb"
"ruby test.rb hostname user passwd" works!
"ruby install.rb" works!

When I run my code I get a dialog from ruby.exe titled "Unable To Locate
Component". It says "This application has failed to start because
mswin32-ruby16.dll was not found. Re-installing the application my fix this
problem."

Is that I file I should have gotten from the one-click installer?
Do I need it?
If so, where can I get it?
Where do I need to put it?

R. Mark Volkmann

unread,
Apr 2, 2005, 8:56:34 AM4/2/05
to
Quoting Kirk Haines <kha...@enigo.com>:

If you go the RAA and search for MySQL, there are three different packages
called mysql-ruby. If I understand correctly, one is for Windows using DBI,
another is for everything else using DBI and the third is for every platform,
but not using DBI.

Can you tell me the URL of the mysql-ruby package that worked for you under
Windows? Do the installation instructions documented at the URL work for you
without modification?

R. Mark Volkmann

unread,
Apr 2, 2005, 8:58:40 AM4/2/05
to
Quoting Adelle Hartley <ade...@bullet.net.au>:

Ah ha! Someone else feels my pain. ;-)

Okay, has anyone successfully used MySQL 4.1 or higher under Windows with some
version of mysql-ruby? If so, what is the URL of the mysql-ruby package that
worked for you? Were you able to install it using the documented steps for
that package?

nobu....@softhome.net

unread,
Apr 2, 2005, 9:49:29 AM4/2/05
to
Hi,

At Sat, 2 Apr 2005 22:52:38 +0900,
R. Mark Volkmann wrote in [ruby-talk:136487]:


> When I run my code I get a dialog from ruby.exe titled "Unable To Locate
> Component". It says "This application has failed to start because
> mswin32-ruby16.dll was not found. Re-installing the application my fix this
> problem."

It is an old version DLL.

> Is that I file I should have gotten from the one-click installer?
> Do I need it?
> If so, where can I get it?
> Where do I need to put it?

You might execute wrong version ruby.exe.
a) check your PATH environment variable, and
b) check if old ruby.exe remain anywhere.

--
Nobu Nakada


James Britt

unread,
Apr 2, 2005, 9:56:28 AM4/2/05
to
R. Mark Volkmann wrote:
> ...

> Ah ha! Someone else feels my pain. ;-)
>
> Okay, has anyone successfully used MySQL 4.1 or higher under Windows with some
> version of mysql-ruby? If so, what is the URL of the mysql-ruby package that
> worked for you? Were you able to install it using the documented steps for
> that package?


I've been using MySQL 4.1 on Windows with Ruby for about a month or so
now. The only issue I had was the change in the way MySQL does password
hashing (which can be corrected by telling MySQL to use the older
password hashing format).

I don't recall where I got my MySQL-Ruby libs; for some reason I had
thought they were included as part of the 1-Click installer, but I
gather that's not so.


Aside from various mysql libs included as part of other applications
(Og, Rails, etc.) I believe the only core lib I use is from TOMITA
Masahiro.

It's installed in c:\ruby\lib\1.8 and is a pure-Ruby lib.

I believe it came from http://www.tmtm.org/en/ruby/mysql/README_en.html

I'm guessing I followed the instructions on that page, though looking at
the content of the tarball there seems to be little for the installer to
do; it basically it just copies the file mysql.rb to the root of your
Ruby lib dir, something you could do by hand.

James

--

http://www.ruby-doc.org
http://www.rubyxml.com
http://catapult.rubyforge.com
http://orbjson.rubyforge.com
http://ooo4r.rubyforge.com
http://www.jamesbritt.com


R. Mark Volkmann

unread,
Apr 2, 2005, 10:28:44 AM4/2/05
to
We have a winner! A big thanks goes out to James Britt!

Here are the steps I used to use MySQL with
the Ruby Windows one-click installer (version 1.8.2-14).

1) Download ruby-mysql-0.2.5.tar.gz
from http://www.tmtm.org/en/ruby/mysql/README_en.html.
2) Unzip this file.
3) Copy mysql.rb to $RUBY_HOME\lib\ruby\1.8.

Sample code:

require 'mysql'

host = 'localhost'
username = 'root'
password = ''
database = 'music'

begin
conn = Mysql.new(host, username, password, database)
rs = conn.query('select * from artists')
column_name = 'name'
rs.each_hash do |row|
puts "name = #{row[column_name]}"
end
rescue Mysql::Error => e
puts "Error! #{e.err}"
ensure
conn.close if conn
end

Maybe someday I'll figure out how to use the DBI API instead so my code won't be
tied to MySQL, but for now this will get me by.

0 new messages