Error in Mysql Connection


#1

Hai

Iam getting error in mysql connection.

C:\Ruby\addr>ruby script/server
=> Booting WEBrick…
=> Rails 2.2.2 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-12-15 18:51:18] INFO WEBrick 1.3.1
[2008-12-15 18:51:18] INFO ruby 1.8.6 (2008-08-11) [i386-mswin32]
[2008-12-15 18:51:18] INFO WEBrick::HTTPServer#start: pid=988 port=3000
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install the mysql gem and try again: gem install my
127.0.0.1 - - [15/Dec/2008:18:51:24 India Standard Time] “GET /contacts/
HTTP/1.1” 500 13864

  • -> /contacts/
    127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] “GET /
    HTTP/1.1” 304 0
  • -> /
    127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] “GET
    /javascripts/prototype.js HTTP/1.1” 304 0
    http://localhost:3000/ -> /javascripts/prototype.js
    127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] “GET
    /javascripts/effects.js HTTP/1.1” 304 0
    http://localhost:3000/ -> /javascripts/effects.js
    127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] “GET
    /images/rails.png HTTP/1.1” 304 0
    http://localhost:3000/ -> /images/rails.png
    !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
    install the mysql gem and try again: gem install my
    127.0.0.1 - - [15/Dec/2008:18:51:41 India Standard Time] “GET /contacts/
    HTTP/1.1” 500 13864
  • -> /contacts/

and kindly give me some better links for the beginner to adapt with ruby
on rails ( Latest)
Iam using ruby 1.8.6 and rails 2.2.2
or which version is better.

Guide me.


#2

im new to ROR but i think i remember using this command when i had
that same error when i first started installing.
ruby\ gem install mysql
it was something along that line.

On Dec 15, 8:31 am, Angappan Ayyavoo <rails-mailing-l…@andreas-


#3

Kyle wrote:

im new to ROR but i think i remember using this command when i had
that same error when i first started installing.
ruby\ gem install mysql
it was something along that line.

On Dec 15, 8:31�am, Angappan Ayyavoo <rails-mailing-l…@andreas-

I tried with that, but getting the same error repeatedly.


#4

With Rails 2, the default database server is SQLite3. You apparently
added the optional MySQL. I recommend you “go with the flow”, i.e.
restart and allow the default DBMS to be used.

HTH,
Richard

On Dec 16, 12:13 am, Angappan Ayyavoo <rails-mailing-l…@andreas-


#5

I looked at you question again, which led me to add a couple of more
things:

Did you notice the advice:
“!!! The bundled mysql.rb driver has been removed from Rails 2.2.
Please
install the mysql gem and try again”

If you don’t know how to use the “gem” system, just Google for gem.
But if you use SQLite3, you won’t have to deal with installing MySQL.

Furthermore, you must have found a way to opt for WEBrick. The norm
for Rails 2 is Mongrel as the webserver. Again, I recommend you go
with the default.

HTH,
Richard

On Dec 16, 12:13 am, Angappan Ayyavoo <rails-mailing-l…@andreas-


#6

I’m guessing in you database.yml file you have this:
development:
adapter: mysql

So you need todo this:

gem install mysql or if mysql is in a none standard area you need to

point to mysql_config like this:

gem install mysql – --with-mysql-config=/usr/local/mysql/bin/

mysql_config (or where ever you have mysql installed)

Show us output from the following:

gem list
inside of you application => rake gems


#7

Freddy A. wrote:

I’m guessing in you database.yml file you have this:
development:
adapter: mysql

So you need todo this:

gem install mysql or if mysql is in a none standard area you need to

point to mysql_config like this:

gem install mysql – --with-mysql-config=/usr/local/mysql/bin/

mysql_config (or where ever you have mysql installed)

Show us output from the following:

gem list
inside of you application => rake gems

I am also facing the same issue. Unable to install mysql gem on Windows
Vista. It throws the below error:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load – mysql

The output for the above commands requested by you are:
C:\Users\Admin\Desktop\Aruna\book>gem list

*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
addressable (2.0.2)
capistrano (2.1.0)
cgi_multipart_eof_fix (2.5.0)
cmdparse (2.0.2)
data_objects (0.9.11)
dm-core (0.9.10)
extlib (0.9.10)
fxri (0.3.6)
fxruby (1.6.12)
gem_plugin (0.2.3)
highline (1.4.0)
hpricot (0.6)
log4r (1.0.5)
mongrel (1.1.2)
mysql (2.7.3)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (2.2.2)
rake (0.8.3)
rubygems-update (1.3.1)
sources (0.0.1)
sqlite3-ruby (1.2.1)
win32-api (1.4.0, 1.0.4)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-process (0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.3.0, 0.2.0)
windows-pr (1.0.1, 0.7.2)

C:\Users\Admin\Desktop\Aruna\book>rake gems
(in C:/Users/Admin/Desktop/Aruna/book)

I = Installed
F = Frozen
R = Framework (loaded before rails starts)


#8

Hao Zhao wrote:

  1. download older MySQL client library, for example one from
    InstantRails:
    http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll

  2. copy the downloaded file to C:\Ruby\bin (or wherever you installed
    Ruby)

  3. restart MySQL server

I did steps 1 and 2 (I don’t run the server on localhost so step 3
appears to be pointless for me.)

I then got an error like: Access Denied: C:/Ruby/bin/…/mysql.so

Turns out when the mysql gem installed, it didn’t set mysql.so to be
executable. I went into Explorer and manually turned it on, and it
started to work. Explorer was showing the read permission but not the
execute permission. Goes to show that this flag does take effect in
Windows after all. :rollseyes:

I’m just documenting this in case someone else finds their way here and
has the same issue.

TX


#9

Thanks for the listing Hao Zhao :slight_smile:


#10

If you upgrade Rails to 2.2.2, you will find that the MYSQL adapter have
been removed from the package. So you have to manually install it using
command ” gem install mysql”. but it is not over for works. when you
are running server and visit the home page, you will get error message
on background “The bundled mysql.rb driver has been removed from Rails
2.2. Please install the mysql gem and try again: gem install mysql.”
So surprise ! why ?

i search many pages with Google and find the reason that the rails
2.2.2 is incompatible with mysql 5.x client. here is a solusion. please
followe the following steps to fix it:

  1. download older MySQL client library, for example one from
    InstantRails:
    http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll

  2. copy the downloaded file to C:\Ruby\bin (or wherever you installed
    Ruby)

  3. restart MySQL server

that’s it.

hope it will help you when you occur such problem.


#11

Trejkaz Xx wrote:

Hao Zhao wrote:

  1. download older MySQL client library, for example one from
    InstantRails:
    http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll

  2. copy the downloaded file to C:\Ruby\bin (or wherever you installed
    Ruby)

  3. restart MySQL server

I did steps 1 and 2 (I don’t run the server on localhost so step 3
appears to be pointless for me.)

I then got an error like: Access Denied: C:/Ruby/bin/…/mysql.so

Turns out when the mysql gem installed, it didn’t set mysql.so to be
executable. I went into Explorer and manually turned it on, and it
started to work. Explorer was showing the read permission but not the
execute permission. Goes to show that this flag does take effect in
Windows after all. :rollseyes:

I’m just documenting this in case someone else finds their way here and
has the same issue.

TX

Actually, after your prompt to drop the lib in the %RUBY_HOME%\bin I
tried the one that is in the %MYSQL_HOME%\bin i.e. not the one
downloaded from InstantRails and it now works (well it seems to, no
probs yet).

So this clearly indicates that Ruby really can’t see libmySQL.dll on the
path i.e. as installed with MySQL itself (5.1 for me).

So for now simply try cp %MYSQL_HOME%\bin\libmySQL.dll %RUBY_HOME%\bin.

Cheers


#12

Darren Bishop wrote:

So for now simply try cp %MYSQL_HOME%\bin\libmySQL.dll %RUBY_HOME%\bin.

The way I saw it, if Rails used to support MySQL without installing
MySQL, then it should still work – hence I don’t have a %MYSQL_HOME% to
copy a DLL from, hence why my instructions mention pilfering it from
InstantRails. Both should work, but I didn’t want to install a whole
DBMS on a system which doesn’t even need one, just to get one DLL out of
it.

I really wish the gem would just include a copy of it or something.
Even if it were to use it as a last resort, it would be much better than
getting obscure error messages with no direct relation to the real
problem.

TX


#13

Trejkaz Xx wrote:

Darren Bishop wrote:

So for now simply try cp %MYSQL_HOME%\bin\libmySQL.dll %RUBY_HOME%\bin.

The way I saw it, if Rails used to support MySQL without installing
MySQL, then it should still work – hence I don’t have a %MYSQL_HOME% to
copy a DLL from, hence why my instructions mention pilfering it from
InstantRails. Both should work, but I didn’t want to install a whole
DBMS on a system which doesn’t even need one, just to get one DLL out of
it.

I really wish the gem would just include a copy of it or something.
Even if it were to use it as a last resort, it would be much better than
getting obscure error messages with no direct relation to the real
problem.

TX

Sorry, my response was more aimed at Hao Zhao, not you Trejkaz; makes
sense what you did (needed to do) especially seeing as you don’t have
MySQL running locally.

Again, sorry for the confusion.


#14

Yes, i solved this problem .
go to ruby shell
type: install gem -v2.3.5 (or your need version for your server)
All thing ok.
Anything , please contact me : removed_email_address@domain.invalid