Error in Mysql Connection

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.

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.

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.

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

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

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

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

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

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

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.

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 : mrvuongx@gmail.com