# Installing Rails: MySQL issue?

**URL:** <https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750>\
**Category:** Ruby\
**Created:** [November 10, 2009, 6:24pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750 "2009-11-10T18:24:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 6:24pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/1 "2009-11-10T18:24:14Z")

</div>

Hello,

I am installing Rails, with MySQL, based on the steps found at:

> **[WDVL](https://wdvl.com)**
>
> Mastering the Art of Online Magazine Creation

The step for MySQL

"Now that we have the Rails framework installed on our system, we need a  
database connector, in order to connect our Rails framework to the MySQL  
database installed.

C:\> gem install mysql

Running the above command does the trick most of the time. However we  
need to take care that MySQL gem gives various problems related to the  
installation path. In order to resolve that, we can compile it with  
various options manually defined."

Well, maybe I am having the aforementioned problem with the installation  
path…when I enter “gem install mysql” (with MySQL 5.1 already  
installed and tested), I get a heap of “No definition for XYZ” messages.  
The page recommends compiling it manually, but does not give any  
indication on how to do this :).

Is there any way to run this manually, or to confirm whether the  
database connector is functional?

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 6:29pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/2 "2009-11-10T18:29:24Z")

</div>

P.S. This configuration installs Ruby, Rails, MySQL, Mongrel, Git, and  
uses Webrick. I am solid on using the first 3 ;). Is Mongrel the  
de-facto app server for Ruby? Is Git the best/most popular (i.e.  
supported) source control? Should I use Webrick or try to use Apache or  
some other web server? Are these loaded questions that will  
inadvertenetly cause me to start some apocalyptic flame war?

These are the questions that plague men’s souls…

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 7:55pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/3 "2009-11-10T19:55:34Z")

</div>

Brian T. wrote:

> Are these loaded questions that will  
> inadvertenetly cause me to start some apocalyptic flame war?

No, it is pretty difficult to start an apocalyptic flame war with this  
bunch, but you’d be almost guaranteed to get more help from a Rails  
mailing list-- try looking here:  
[http://www.ruby-forum.com/forum/3](http://www.ruby-forum.com/forum/3)

As an aside, I just recently read that Sqlite3 was now considered the  
default setup with Rails2. Rails definitely plays nicer when you go with  
the convention, so you might consider looking into Sqlite.

HTH,  
Howard

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 8:10pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/4 "2009-11-10T20:10:40Z")

</div>

Howard R. wrote:

> As an aside, I just recently read that Sqlite3 was now considered the  
> default setup with Rails2. Rails definitely plays nicer when you go with  
> the convention, so you might consider looking into Sqlite.

There was recently a conversation about this; the gist of it was that  
sqlite had been made the default because it was really really easy to  
set up and readily available (which means, it comes with OSX). In this  
situation, it just means it’s easier to get started, it doesn’t mean  
sqlite is good for your needs.

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 8:11pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/5 "2009-11-10T20:11:40Z")

</div>

Howard R. wrote:  
[…]

> As an aside, I just recently read that Sqlite3 was now considered the  
> default setup with Rails2. Rails definitely plays nicer when you go with  
> the convention, so you might consider looking into Sqlite.

Not quite. SQLite is the default for Rails, but only because it makes  
quick-and-dirty development a little easier. No one in his right mind  
would use SQLite for a production Web application, and many of us don’t  
use it for development. It’s one default that’s safe to ignore.

> HTH,  
> Howard

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 8:40pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/6 "2009-11-10T20:40:47Z")

</div>

On Nov 10, 2:24 pm, Brian T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> I am installing Rails, with MySQL, based on the steps found at:
> 
> [WDVL - Mastering the Art of Online Magazine Creation](http://www.wdvl.com/Authoring/ror/Vista/saurabh_bhatia10202009.html)

Please use MinGW based Ruby instead of One-Click:

[http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/](http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/)

You can download latest RC1 instead of Preview2:  
[http://rubyforge.org/forum/forum.php?forum\_id=35591](http://rubyforge.org/forum/forum.php?forum_id=35591)

Please now use official [gems.rubyforge.org](http://gems.rubyforge.org) without specifying  
rubyinstaller source during gem installation.

> C:\> gem install mysql
> 
> Running the above command does the trick most of the time. However we  
> need to take care that MySQL gem gives various problems related to the  
> installation path. In order to resolve that, we can compile it with  
> various options manually defined."

The binary version of MySQL gem was built against MySQL 5.0. As  
mentioned in the post, using 5.1 will generate issues, and most likely  
segmentation faults.

> Well, maybe I am having the aforementioned problem with the installation  
> path…when I enter “gem install mysql” (with MySQL 5.1 already  
> installed and tested), I get a heap of “No definition for XYZ” messages.  
> The page recommends compiling it manually, but does not give any  
> indication on how to do this :).

You can safely ignore “No definition for XYZ”, that is a issue with  
RDoc trying to generate documentation for SWIG interface, and failing  
due the lack of comments.

> Is there any way to run this manually, or to confirm whether the  
> database connector is functional?

Using the above examples you get a functional Ruby and MySQL.

HTH,

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 9:22pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/7 "2009-11-10T21:22:55Z")

</div>

I updated gems to the latest version and all my ruby scripts that use  
mysql started immediately bombing out. I read on some websites that I  
should do a “gem install mysql” in order to get the driver back but I am  
now getting the error:

“Failed to build gem native extension”

Other websites say to include the path to mysql and I have tried this  
command to no avail:

“gem install mysql – with-mysql-dir=/usr/bin/”

Can anyone help me get this running?

thanks

jackster

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 10:20pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/8 "2009-11-10T22:20:53Z")

</div>

On Nov 10, 4:59 pm, Brian T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Howard R. wrote:
> 
> > No, it is pretty difficult to start an apocalyptic flame war with this  
> > bunch, but you’d be almost guaranteed to get more help from a Rails  
> > mailing list-- try looking here:  
> > [http://www.ruby-forum.com/forum/3](http://www.ruby-forum.com/forum/3)
> 
> Thanks, I will post this there, too.
> 
> I do want to use MySQL, and I’d like to use the 5.1 version if possible  
> (I am wary of X.0 versions in general).

Contrary to common approaches. MySQL 5.0.x is pretty stable (5.0.83 is  
the latest one I’ve tested).

If you want to build the extension for MySQL 5.1 you should:

1. Get RubyInstaller: [http://rubyinstaller.org/](http://rubyinstaller.org/) (RC1 is latest  
version)
2. Grab and unpack latest DevKit
3. Perform a gem installation of source MySQL:

gem install mysql --platform=ruby --with-mysql-include=“C:/Program  
Files/MySQL/MySQL Server 5.1/opt/include” --with-mysql-lib=“C:/Program  
Files/MySQL/MySQL Server 5.1/opt/lib”

–platform=ruby will force to install form source.

In theory, that should do the trick.  
(gem configuration optiosn from top of my head, please check the  
output of gem installation to verify)

HTH,

---

<div class="post-metadata">

**Author:** ![bct](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bct](https://www.ruby-forum.com/u/bct)\
**Post date:** [November 10, 2009, 8:59pm UTC](https://www.ruby-forum.com/t/installing-rails-mysql-issue/178750/9 "2009-11-10T20:59:24Z")

</div>

Howard R. wrote:

> No, it is pretty difficult to start an apocalyptic flame war with this  
> bunch, but you’d be almost guaranteed to get more help from a Rails  
> mailing list-- try looking here:  
> [http://www.ruby-forum.com/forum/3](http://www.ruby-forum.com/forum/3)

Thanks, I will post this there, too.

I do want to use MySQL, and I’d like to use the 5.1 version if possible  
(I am wary of X.0 versions in general).
