# Gem install mysql failure

**URL:** <https://www.ruby-forum.com/t/gem-install-mysql-failure/87786>\
**Category:** Ruby\
**Created:** [March 5, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786 "2007-03-05T23:47:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [March 5, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786/1 "2007-03-05T23:47:22Z")

</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:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–srcdir=.  
–curdir  
–ruby=c:/program files/ruby/bin/ruby  
–with-mysql-config  
–without-mysql-config  
–with-mysql-dir  
–without-mysql-dir  
–with-mysql-include  
–without-mysql-include=${mysql-dir}/include  
–with-mysql-lib  
–without-mysql-lib=${mysql-dir}/lib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-mlib  
–without-mlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-zlib  
–without-zlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-socketlib  
–without-socketlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-nsllib  
–without-nsllib  
–with-mysqlclientlib  
–without-mysqlclientlib

ERROR: While executing gem … (RuntimeError)  
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

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [March 6, 2007, 12:01am UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786/2 "2007-03-06T00:01:14Z")

</div>

On Mar 5, 3:47 pm, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [March 6, 2007, 2:39am UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786/3 "2007-03-06T02:39:25Z")

</div>

Chris S. wrote:

> On Mar 5, 3:47 pm, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [March 6, 2007, 3:00am UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786/4 "2007-03-06T03:00:29Z")

</div>

On Mar 5, 6:39 pm, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 O.-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/)), but I’m guessing it’s not.

HTH,  
Chris

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [March 6, 2007, 11:06pm UTC](https://www.ruby-forum.com/t/gem-install-mysql-failure/87786/5 "2007-03-06T23:06:43Z")

</div>

Chris S. wrote:

> On Mar 5, 6:39 pm, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 O.-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/)), 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:

require “mysql”

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

Running this gave me the error:

Error code: 1045  
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
