Problems with Rails server/mysql2 gem

Environment:

Windows 7 64bit (Home Premium)

Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]

Rails 3.0.10

MySQL 5.5

The task at hand: Teaching myself web-based database stuff through the
Ruby on Rails Framework - I have no prior experience with this…

The problem: Ruby, despite my having successfully installed the mysql2
rubygem thinks that the gem is missing when I invoke a rails command
that requires it.

After having spent the evening getting the mysql rubygem installed on
Windows 64 bit, I decided to (finally) get cracking on linking mysql to
a local rails server. This is how I was trying to do it…

(Fairly) Exact transcript from cmd.exe

C:\rails\cookbook>gem install mysql --platform=ruby –
–with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1…
Installing RDoc documentation for mysql-2.8.1…
(I thought this was successful mysql install, should I test it somehow?)

C:>gem install mysql2 --platform=ruby –
–with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Fetching: mysql2-0.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
Successfully installed mysql2-0.3.7
1 gem installed
Installing ri documentation for mysql2-0.3.7…
Enclosing class/module ‘mMysql2’ for class Client not known
Installing RDoc documentation for mysql2-0.3.7…
Enclosing class/module ‘mMysql2’ for class Client not known
(Same as above - I thought this was successful mysql install)

C:\rails>rails new cookbook -d mysql
(successfully creates directories for project in c:\rails\cookbook)

C:\rails\cookbook>rails server
?[31mCould not find gem ‘mysql2 (~> 0.2.11)’ in any of the gem sources
listed in your Gemfile.?[0m
?[33mRun bundle install to install missing gems.?[0m

Notes:
I noticed it wants rubygem mysql2-0.2.11, I have 0.3.7. I tried
installing 0.2.11 specifically by the method I used to install the two
gems above. No dice, it couldn’t find a gem by the name mysql2-0.2.11 in
‘any repository’

I’m stumped, any thoughts fellas (and gals)?

Hi

Use the following environment:

Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]

mysql2 (0.2.6 x86-mingw32)
Rails 3.0.9
rake 0.9.2
gem 1.8.8
mysql5.1

thanks,
reddy

Awesome, I suspected the mysql2 version was causing problems. Where can
I get the 0.2.11 version of mysql2 from?

On Sep 7, 12:20am, Chris D. [email protected] wrote:

The task at hand: Teaching myself web-based database stuff through the
Ruby on Rails Framework - I have no prior experience with this…

The problem: Ruby, despite my having successfully installed the mysql2
rubygem thinks that the gem is missing when I invoke a rails command
that requires it.

After having spent the evening getting the mysql rubygem installed on
Windows 64 bit, I decided to (finally) get cracking on linking mysql to
a local rails server. This is how I was trying to do it…

Problem is that you’re trying to link Ruby (32bits) against MySQL
(64bits) library.

Please read this:

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

After you installed, you will require to modify your Gemfile to
reflect either “mysql” or “mysql2” gems and don’t forget to adjust
“adapter” in config/database.yml


Luis L.