Installing Rails: MySQL issue?

B

Brian Tickler

Hello,

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

http://www.wdvl.com/Authoring/ror/Vista/saurabh_bhatia10202009.html

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?
 
B

Brian Tickler

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

Howard Roberts

Brian said:
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

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
 
A

Aldric Giacomoni

Howard said:
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.
 
M

Marnen Laibow-Koser

Howard Roberts 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,
 
L

Luis Lavena

Hello,

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

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/

You can download latest RC1 instead of Preview2:
http://rubyforge.org/forum/forum.php?forum_id=35591

Please now use official 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,
 
B

Brian Tickler

Howard said:
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

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).
 
J

jackster the jackle

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
 
L

Luis Lavena

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/ (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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top