# Gem install mysql failure

**URL:** <https://rubytalk.org/t/gem-install-mysql-failure/35901>\
**Category:** ruby-talk\
**Created:** [5 March 2007 22:47 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901 "2007-03-05T22:47:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Hammer](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Paul\_Hammer](https://rubytalk.org/u/Paul_Hammer)\
**Post date:** [5 March 2007 22:47 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901/1 "2007-03-05T22:47:24Z")

</div>

I've been using Ruby with Watir for a few months now to scrape data  
off of internal web pages where I work. I'm fairly happy with the  
results,  
although I want to improve these processes. I want to put this data  
into  
mysql, so I tried using this command to load mysql:

gem install mysql

The result I got is below. Can anyone help me here?

Paul

Select which gem to install for your platform (i386-mswin32)  
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

> 5

Building native extensions. This could take a while...  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

Provided configuration options:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-dir  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-dir  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-include  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-include=${opt-dir}/include  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-lib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-lib=${opt-dir}/lib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-make-prog  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--srcdir=.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--curdir  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--ruby=c:/program files/ruby/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-config  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-config  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-dir  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-dir  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-include  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-include=${mysql-dir}/include  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-lib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-lib=${mysql-dir}/lib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-zlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-zlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-socketlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-socketlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-nsllib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-nsllib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib

ERROR: While executing gem ... (RuntimeError)  
&nbsp;&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension.  
Gem files will remain installed in c:/Program  
Files/ruby/lib/ruby/gems/1.8/gem  
mysql-2.5.1 for inspection.

Results logged to c:/Program  
Files/ruby/lib/ruby/gems/1.8/gems/mysql-2.5.1/gem  
ake.out

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Chris\_Shea1](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@Chris\_Shea1](https://rubytalk.org/u/Chris_Shea1)\
**Post date:** [5 March 2007 23:00 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901/2 "2007-03-05T23:00:06Z")

</div>

Try one of the mswin32 options instead. I think the rule is if you  
installed via the One-Click Installer, you have to.

> **···**
>
> On Mar 5, 3:47 pm, Paul Hammer \<paul\_ham...@hotmail.com\> wrote:
> 
> > I've been using Ruby with Watir for a few months now to scrape data  
> > off of internal web pages where I work. I'm fairly happy with the  
> > results,  
> > although I want to improve these processes. I want to put this data  
> > into  
> > mysql, so I tried using this command to load mysql:
> > 
> > gem install mysql
> > 
> > The result I got is below. Can anyone help me here?
> > 
> > Paul
> > 
> > Select which gem to install for your platform (i386-mswin32)  
> > 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\> 5
> > 
> > Building native extensions. This could take a while...  
> > \*\*\* extconf.rb failed \*\*\*  
> > Could not create Makefile due to some reason, probably lack of  
> > necessary libraries and/or headers. Check the mkmf.log file for more  
> > details. You may need configuration options.
> > 
> > Provided configuration options:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-dir  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-dir  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-include  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-include=${opt-dir}/include  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-lib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-lib=${opt-dir}/lib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-make-prog  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--srcdir=.  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--curdir  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--ruby=c:/program files/ruby/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-config  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-config  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-dir  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-dir  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-include  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-include=${mysql-dir}/include  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysql-lib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-lib=${mysql-dir}/lib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-zlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-zlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-socketlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-socketlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-nsllib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-nsllib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysqlclientlib
> > 
> > ERROR: While executing gem ... (RuntimeError)  
> > &nbsp;&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension.  
> > Gem files will remain installed in c:/Program  
> > Files/ruby/lib/ruby/gems/1.8/gem  
> > mysql-2.5.1 for inspection.
> > 
> > Results logged to c:/Program  
> > Files/ruby/lib/ruby/gems/1.8/gems/mysql-2.5.1/gem  
> > ake.out
> > 
> > --  
> > Posted viahttp://www.ruby-forum.com/.

---

<div class="post-metadata">

**Author:** ![Paul\_Hammer](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Paul\_Hammer](https://rubytalk.org/u/Paul_Hammer)\
**Post date:** [6 March 2007 01:39 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901/3 "2007-03-06T01:39:28Z")

</div>

Chris Shea wrote:

> **···**
>
> > On Mar 5, 3:47 pm, Paul Hammer \<paul\_ham...@hotmail.com\> wrote:
> > 
> > > Building native extensions. This could take a while...  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-lib  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-mysql-include=${mysql-dir}/include  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-mysqlclientlib  
> > > ERROR: While executing gem ... (RuntimeError)  
> > > Posted viahttp://www.ruby-forum.com/.
> > 
> > Try one of the mswin32 options instead. I think the rule is if you  
> > installed via the One-Click Installer, you have to.
> 
> I'm new to gem also. Is the mswin32 option a command line option to  
> gem?
> 
> What is the One-Click Installer? Where can I read about this?
> 
> Paul
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Chris\_Shea1](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@Chris\_Shea1](https://rubytalk.org/u/Chris_Shea1)\
**Post date:** [6 March 2007 02:00 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901/4 "2007-03-06T02:00:07Z")

</div>

Paul,

What I meant was: when you run 'gem install mysql' choose an install  
option with (mswin32) at the end. So when faced with this:

Select which gem to install for your platform (i386-mswin32)  
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

Choose 1 or 2.

The Ruby One-Click Installer is found here: [http://rubyinstaller.rubyforge.org/wiki/wiki.pl](http://rubyinstaller.rubyforge.org/wiki/wiki.pl)  
It installs Ruby, and sets environment options, and installs a lot of  
helpful tools (like rubygems and the Win32API bindings). I assumed  
your installation of Ruby was handled by it, many Windows  
installations are.

The other main possibility is that Ruby is installed on top of Cygwin  
([http://cygwin.com/\](http://cygwin.com/%5C)), but I'm guessing it's not.

HTH,  
Chris

> **···**
>
> On Mar 5, 6:39 pm, Paul Hammer \<paul\_ham...@hotmail.com\> wrote:
> 
> > Chris Shea wrote:  
> > \> On Mar 5, 3:47 pm, Paul Hammer \<paul\_ham...@hotmail.com\> wrote:
> > 
> > \>\> Building native extensions. This could take a while...  
> > \>\> --with-opt-lib  
> > \>\> --without-mysql-include=${mysql-dir}/include  
> > \>\> --with-mysqlclientlib  
> > \>\> ERROR: While executing gem ... (RuntimeError)  
> > \>\> Posted viahttp://www.ruby-forum.com/.  
> > \> Try one of the mswin32 options instead. I think the rule is if you  
> > \> installed via the One-Click Installer, you have to.
> > 
> > I'm new to gem also. Is the mswin32 option a command line option to  
> > gem?
> > 
> > What is the One-Click Installer? Where can I read about this?
> > 
> > Paul
> > 
> > --  
> > Posted viahttp://www.ruby-forum.com/.

---

<div class="post-metadata">

**Author:** ![Paul\_Hammer](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Paul\_Hammer](https://rubytalk.org/u/Paul_Hammer)\
**Post date:** [6 March 2007 22:06 UTC](https://rubytalk.org/t/gem-install-mysql-failure/35901/5 "2007-03-06T22:06:50Z")

</div>

Chris Shea wrote:

> > \> installed via the One-Click Installer, you have to.
> > 
> > I'm new to gem also. Is the mswin32 option a command line option to  
> > gem?
> > 
> > What is the One-Click Installer? Where can I read about this?
> > 
> > Paul
> > 
> > --  
> > Posted viahttp://www.ruby-forum.com/.
> 
> Paul,
> 
> What I meant was: when you run 'gem install mysql' choose an install  
> option with (mswin32) at the end. So when faced with this:
> 
> Select which gem to install for your platform (i386-mswin32)  
> 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
> 
> Choose 1 or 2.
> 
> The Ruby One-Click Installer is found here:  
> [http://rubyinstaller.rubyforge.org/wiki/wiki.pl](http://rubyinstaller.rubyforge.org/wiki/wiki.pl)  
> It installs Ruby, and sets environment options, and installs a lot of  
> helpful tools (like rubygems and the Win32API bindings). I assumed  
> your installation of Ruby was handled by it, many Windows  
> installations are.
> 
> The other main possibility is that Ruby is installed on top of Cygwin  
> ([http://cygwin.com/\](http://cygwin.com/%5C)), but I'm guessing it's not.
> 
> HTH,  
> Chris

Hi Chris,

Thanks for your help. This has gotten me further. I selected 1. mysql  
2.7.3 (mswin32), and the install completed quickly without an error.

Next, I did a web search and found this example ruby script:

&nbsp;&nbsp;&nbsp;require "mysql"

&nbsp;&nbsp;&nbsp;begin  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# connect to the MySQL server  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbh = Mysql.real\_connect("localhost", "testuser", "testpass",  
"test")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# get server version string and display it  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Server version: " + dbh.get\_server\_info  
&nbsp;&nbsp;&nbsp;rescue Mysql::Error =\> e  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Error code: #{e.errno}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Error message: #{e.error}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Error SQLSTATE: #{e.sqlstate}" if e.respond\_to?("sqlstate")  
&nbsp;&nbsp;&nbsp;ensure  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# disconnect from server  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbh.close if dbh  
&nbsp;&nbsp;&nbsp;end

Running this gave me the error:

&nbsp;&nbsp;Error code: 1045  
&nbsp;&nbsp;Error message: Access denied for user 'testuser'@'localhost' (using  
password: YES)

I have tried searching for where mysql is been installed, and can't find  
it.

Installing mysql in the past I've been able to set the root password. I  
didn't get that chance here.

So, I now have questions:

This is progress because the login has been attempted, right?  
What users & passwords come along with a gem install? How do I set  
these?  
I'd like to run mysql by hand also. Where has mysql been installed?

Paul

> **···**
>
> > On Mar 5, 6:39 pm, Paul Hammer \<paul\_ham...@hotmail.com\> wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
