Problems installing mysql gem in Windows Vista

86 views
Skip to first unread message

Schalk Neethling

unread,
Nov 23, 2008, 7:35:29 PM11/23/08
to rubyonra...@googlegroups.com
Hey all,

The problems keep coming. Having upgraded everything and upgraded to
Rails 2.2.2 I now wanted to install the MySQL gem as I am getting the
following error when trying to load up the app.

no such file to load -- mysql

Normally running gem install mysql works with no problems but, now I get
the following:

gem install mysql -- --with-mysql-config=C:\InstantRails\mysql\bin
Successfully installed mysql-2.7.3-x86-mswin32
1 gem installed
Installing ri documentation for mysql-2.7.3-x86-mswin32...
Installing RDoc documentation for mysql-2.7.3-x86-mswin32...
ERROR: While generating documentation for mysql-2.7.3-x86-mswin32
... MESSAGE: Unhandled special: Special: type=17, text="<!-- $Id:
README.html,v 1.20 2006-12-20 05:31:52 tommy Exp $ -->"
... RDOC args: --op
C:/InstantRails/ruby/lib/ruby/gems/1.8/doc/mysql-2.7.3-x86-mswin32/rdoc
--exclude ext --main README --quiet ext README docs/README.html
(continuing with the rest of the installation)

The last line is misleading because when I go to the mysql folder after
the installation has completed, it is completely empty. Does anyone have
any idea if there are problems with the MySQL 2.7.3 gem? What else could
be going wrong here?

Thanks,
Schalk

Rick

unread,
Nov 24, 2008, 1:28:41 AM11/24/08
to Ruby on Rails: Talk
Hi Schalk,

I've noticed that myself. It seems that at some point the what
gemspec file got corrupted or abandoned or your guess goes here in
gold. You've got maybe three options available.

1) Find a pre-built gem in whatever passes for package format on your
os.

2) Build your own gemspec to acompany the available source, build and
install your own local gem.

3) Find someone who can provide you with some more options.

I might be able to help you with option 2 if that's the way you want
to go. You'll need a c compiler and MySql installed. I figured out
how to do it (so it can't be that hard) when I noticed that
mysql-2.7.3 is advertised but doesn't install on my machine and that
mysql-2.8 has been available since aug2008.

4) Actually, now that I think of it, maybe we could get someone to add
gemspec's to the source, or provide a simple way to do a gem install
without a gemspec. That sounds like option 3, above.

Rick

Schalk Neethling

unread,
Nov 24, 2008, 7:19:37 PM11/24/08
to rubyonra...@googlegroups.com
Hi there Rick,

I have given up on the Rakismet plugin and will go with the Railscast
solution, if it works for them it will work for me. Now my problem is
getting a working MySQL gem installed to use along Rails 2.2.2 or even
2.1.2.

If you or anyone else have some pointers I am all ears. BTW, I am on
Windows Vista.

Thanks,
Schalk

Rick

unread,
Nov 25, 2008, 1:11:42 AM11/25/08
to Ruby on Rails: Talk
Hey Schalk,

Not to make your life more confusing than it already is but...

You have three ways to go for your database, they're all supported
within RoR. I've run all three in my environment but I haven't done
anything with Vista.

1) sqlite3 - only need to install one gem, memory resident, good for
first apps and rapid prototyping. This is the database that rails
sets you up for by default. "gem install sqlite3-ruby" I can't
recall if this gem is installed as part of the rails gem or not.

2) MySql - need to install the MySql server (or point at somebody
else's :-), a db management app, and gem. Real industrial strength
for the growth path we all hope we need. You'll need to learn to do
limited database management work, not huge but can take time away from
app work.

Go to http://www.mysql.com/ and follow the download pointers for the
"community server" for your system, it's free. You'll also need to
get the mysql-ruby gem. If you can find a pre-built version for your
system that might be a good approach, otherwise it'll need to be
compiled which means you'll want a c compiler (gcc is fine and
free). The gem source lives at http://www.tmtm.org/en/mysql/ruby/.
I go there because the only version that currently "gem install"s was
released in August 2005. I know I've seen some bug fix chatter
related to windows in the later versions so you might end up there as
well - if you can't find a built package for your machine.

Like the time it takes to learn to dbadmin, this will take time - less
than a coffee if all goes well. The compilation step should be
automatically done as part of the gem install but I know this isn't
always fire and forget. There's also a version

3) postgreSQL - similar situation to mysql, load an application and a
gem - the gem needs to be compiled if you can't find one packaged for
your environment. The app and admin tool both come from
http://wiki.rubyonrails.org/rails/pages/PostgreSQL. This is also the
place to go for documentation, wiki chatter, et al. Nice site in
fact.

There are at least three variants of the gem - postgres, postgres-pr,
and pg. pg is the one that works right now, pg (0.7.9.2008.10.13) is
what you should see with "gem list pg --remote". This one will
compile during the install so once again you'll want a c compiler on
board.
Go to http://rubyforge.org/projects/ruby-pg for the gem source if you
need to.


So there you go. Probably way more than you wanted to know but what
the hea, you asked.

My advise would be to start with sqlite and get comfortable with how
RoR works in your box. I don't know anything about your general level
of comfort / experience so, obviously, you do what feels right.
Honestly, the only limit I've found with sqlite is I haven't yet
puzzled out how to look at the tables - like with one of the dbadmin
tools.

By the way, what are you using for an editor? And do you have a unix-
like interface available?

tally ho,
Rick

Hassan Schroeder

unread,
Nov 25, 2008, 1:51:01 AM11/25/08
to rubyonra...@googlegroups.com
On Mon, Nov 24, 2008 at 10:11 PM, Rick <Richard...@gmail.com> wrote:

> Honestly, the only limit I've found with sqlite is I haven't yet
> puzzled out how to look at the tables - like with one of the dbadmin
> tools.

prompt% cd ~/projects/foo
prompt% sqlite3 db/development.sqlite3
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .tables
bar
sqlite> .schema bar
... etc .

HTH,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com

CharlesB

unread,
Nov 25, 2008, 9:41:04 AM11/25/08
to Ruby on Rails: Talk

I had the same exact error message when I first tried to install the
mysql-2.7.3 gem. But from the error message, we clearly see that only
the RDocs are not being installed.

You can confirm that if you do a "gem list". If you want, you can
simply do:

gem install mysql --no-ri --no-rdoc

It will install the gem, but not the documentation (which, from a
Rails point of view, you should not be concerned about anyway).

Other than that, if Rails 2.2.2 still fails to load, then either you
have not installed MySQL server itself, or somehow libmysql.dll is not
on the path list. Simply type "path" at the command prompt and check
if your mysql\bin directory is listed there. If not, add it.

Cheers!

CharlesB

Schalk Neethling

unread,
Nov 25, 2008, 6:39:29 PM11/25/08
to rubyonra...@googlegroups.com
Hey All,

Executing: gem install mysql --no-ri --no-rdoc tells me that it
installed one gem without any errors. However looking at the folder
inside InstantRails, something seems missing. There is no lib for example.

Also, a simple line like this:

@content = Content.find_by_permalink('introduction')

Is throwing one heck of an error (here is a small bit of it):

Processing ContentController#index (for 127.0.0.1 at 2008-11-26
01:17:28) [GET]
[4;36;1mSQL (1.0ms) [0m [0;1mSET NAMES 'utf8' [0m
[4;35;1mSQL (0.0ms) [0m [0mSET SQL_AUTO_IS_NULL=0 [0m
[4;36;1mContent Columns (33.0ms) [0m [0;1mSHOW FIELDS FROM
`contents` [0m
[4;35;1mContent Load (1.0ms) [0m [0mSELECT * FROM `contents`
WHERE (`contents`.`permalink` = 'introduction') LIMIT 1 [0m

ArgumentError (NULL pointer given):
(eval):3:in `each_hash'
(eval):3:in `all_hashes'

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:564:in
`select'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in
`cache_sql'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:635:in
`find_by_sql'

No my first assumption is, this is related to a bad mysql gem
installation but, for the sake of covering all basis, does anyone know
whether anything has changed in the way databases get's set-up in the
database.yml file in 2.2.2?

Current:

development:
adapter: mysql
encoding: utf8
database: osc_development
username: user
password: pass
host: localhost

Thanks for all assistance, thankfully I now see that it is not only me
struggling with this issue.
Schalk

Rick

unread,
Nov 26, 2008, 9:08:59 PM11/26/08
to Ruby on Rails: Talk
Hey Schalk,

The autogenerated database.yml did get one new line (as of 2.2.0) that
shows up in 2.2.2 yml files.

development:
adapter: mysql
encoding: utf8
database: t222m_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock

NOTE:
pool: 5

I've deleted the line, however, and it doesn't prevent the database
connection from being made. I'm not sure where to look for the
documentation but my guess is pool: is used as a client count /
performance hack.

Also thinking of all the bases,

1) Do you have mysql installed?

2) Can you access it as follows ---

mysql -uuser -ppass

where user => the username from database.yml
and pass => the password from database.yml

3) Does this user have necessary privileges to create a database?

4) Have you created a database for your new project?

Rick

Matthew Phillips

unread,
Nov 27, 2008, 7:23:31 PM11/27/08
to rubyonra...@googlegroups.com
I'm having similar problems. I also get the "NULL pointer given" error
when I try to go to localhost:3000. The problem is that I'm able to log
into database from the commandline.

I wonder if the problem has to do with using 64-bit MySQL server...

It's very frustrating that they are pushing us to use this new GEM when
they haven't properly tested everything to make the transition smooth.
--
Posted via http://www.ruby-forum.com/.

Schalk Neethling

unread,
Nov 28, 2008, 2:37:53 AM11/28/08
to rubyonra...@googlegroups.com
Hey Matthew,

Sorry I cannot provide you with an answer but, I basically decided to go
back to 2.0.2 as there seems to be a few shortcomings with 2.1.2 and 2.2.2.

Regards,
Schalk

m

unread,
Nov 27, 2008, 6:29:55 PM11/27/08
to Ruby on Rails: Talk
I'm having very similar problems. Ever since they switched to the gem
only I am wasting a lot of time that should be spent developing. It's
very frustrating. Here is my environment:

Desktop: Windows Vista 64-bit - MySQL 64-bit server, RoR 2.2.2

Currently I am getting the "NULL point" errors that are talked about
above. the libmysql.dll file IS in the path and I am able to log into
mysql from the command line. Also I have:

Laptop: Windows Vista 64-bit - MySQL Tools (no server), RoR 2.2.2.

I get the libmysql.dll not found ruby error (that's a ruby error, not
rails error). I do have a libmysql.dll file in the mysql tools
directory and I put that in my path, but the tools don't come with a
command line mysql application as I don't need one. Rails should be
logging into the desktop's mysql server.

This is a very frustrating problem and I'm not even sure what
direction I need to go next.

Ed

unread,
Dec 5, 2008, 6:43:25 PM12/5/08
to Ruby on Rails: Talk
I just started struggling with the same problem as described in this
thread, starting when I updated rails from 2.1.2 to 2.2.2. My apps
work fine in rails 2.1.2. When I change environment.rb to 2.2.2, boom
they blow up. Error message says:

"The bundled mysql.rb driver has been removed from rails 2.2. Please
install the mysql gem and try again: gem install mysql."

When I try to install the mysql gem, I get the error described by
Schalk. Says it's just a doc error, and gem list shows mysql gem
installed, but the error above still happens. Have tried uninstalling
and reinstalling mysql, no change.

I am on Vista 32, running Instant Rails. Mysql 5.0 is installed and I
can access it both from the command line and from myPhp interface.
Also, when I change environment.rb setting back to 2.1.2, app runs
just fine.

Has anyone made any progress in figuring this out? TIA

Ed

unread,
Dec 5, 2008, 7:06:48 PM12/5/08
to Ruby on Rails: Talk
Update: Found this solution on ruby forum: http://www.ruby-forum.com/topic/171640

Copy the file libmysql.dll from mysql/bin to ruby/bin.

It worked for me. Environment starts and app executes properly in
2.2.2 now. Still get the rdoc error when installing mysql, but it
doesn't seem to affect the environment.

TonyB

unread,
Dec 12, 2008, 6:31:09 PM12/12/08
to Ruby on Rails: Talk
Hi Schalk

I had the same problem with rails 2.2.2 ...

ArgumentError (NULL pointer given):
(eval):3:in `each_hash'
(eval):3:in `all_hashes'

I my case I was running MySQL 5.1.30 on a Windows environment too so
I decided to switch 'back' to MySQL 5.0.67 and this worked for me. So
maybe this can help you or others solving the problem.



On Nov 26, 12:39 am, Schalk Neethling <volume4.sch...@gmail.com>
wrote:

TonyB

unread,
Dec 12, 2008, 6:31:09 PM12/12/08
to Ruby on Rails: Talk
Hi Schalk

I had the same problem with rails 2.2.2 ...

ArgumentError (NULL pointer given):
(eval):3:in `each_hash'
(eval):3:in `all_hashes'

I my case I was running MySQL 5.1.30 on a Windows environment too so
I decided to switch 'back' to MySQL 5.0.67 and this worked for me. So
maybe this can help you or others solving the problem.



On Nov 26, 12:39 am, Schalk Neethling <volume4.sch...@gmail.com>
wrote:

Mohammad Ali

unread,
Dec 30, 2008, 9:49:33 AM12/30/08
to Ruby on Rails: Talk
I think the solution suggested by - CharlesB (25 Nov) is pretty
straight forward. Somehow the incomplete installation of mysql gem,
doesnt has the chance to add mysql's bin directory path to windows
environment variable "Path".
Simply put a an additional entry there, i.e. in my case "C:\wamp\bin
\mysql\mysql5.0.51b\bin" & vola! it works.

for someone like my colleague, (called me to help on the issue) who
doesnt knows how to do it,

right click the 'My Computer' (desktop icon) or 'Computer' ( in start
menu)
Choose 'Advance System Settings' from left panel
From the 'System Properties' window select 'Advanced' tab,
click 'environment variables' button
locate 'Path' variable, usually in 'System Variables'
click 'Edit'
Add your Mysql's bin directory path to it i.e. ';C:\wamp\bin\mysql
\mysql5.0.51b\bin;"
click OK, OK

run the migration, it should work now.




copying & pasting the libmysql.dll file from mysql\bin directory to
ruby\bin is another workaround, reported by Ed from ruby-forum, but I
like the above solution, as it caters to the deficency left by
incomplete installation of gem install mysql.
Reply all
Reply to author
Forward
0 new messages