Wednesday, August 26, 2009

Rails 2.3 migration issues with MySQL 5.1.3


depot>rake db:migrate --trace
(in D:/Projects/RoR/depot)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version`
varchar(255) NOT NULL) ENGINE=InnoDB
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract_adapter.rb:212:in `log'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/mysql_adapter.rb:320:in `execute'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract/schema_statements.rb:114:in `create_table'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/mysql_adapter.rb:473:in `create_table'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract/schema_statements.rb:320:in `initialize_schema_migration_table'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:436:in `initialize'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:400:in `new'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:400:in `up'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:383:in `migrate'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/databases.rake:116
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with call_chain'
d:/tools/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with call_chain'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_tas'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
d:/Tools/Ruby/bin/rake:19:in `load'
d:/Tools/Ruby/bin/rake:19

As I understood the client MySQL library doesn't work well with Rails 2.3. We can resolve this by using the older MySQL client library (libmySQL.dll). You can get it here http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll.
Just put it in <ruby base dir>\bin\ and restart MySQL service.

12 comments:

  1. thanks and it worked for me.

    ReplyDelete
  2. great suggestion... it works also for me

    ReplyDelete
  3. Also for me
    Thankyou!

    ReplyDelete
  4. I did as u said, but i still get the same error.

    My error reads slightly different, as follows:
    C:\webserver\Redmine\redmine-1.0.4>rake db:migrate --trace
    (in C:/webserver/Redmine/redmine-1.0.4)
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    No such file or directory - C:/webserver/Redmine/redmine-1.0.4/config/database.y
    ml
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ
    er.rb:902:in `read'
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ
    er.rb:902:in `database_configuration'
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ
    er.rb:437:in `initialize_database'
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ
    er.rb:141:in `process'
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ
    er.rb:113:in `send'
    C:/webserver/Redmine/redmine-1.0.4/config/../vendor/rails/railties/lib/initializ

    ReplyDelete
  5. Hi,
    I found the solution...
    I had forgotten to change the example file to yml file...

    Anyway, now i am stuck with somethin els...
    Wen i typeds this:rake db:migrate

    i got this error...
    Please lemme know if there is a work around....

    C:\webserver\Redmine\redmine-1.0.4>rake db:migrate
    (in C:/webserver/Redmine/redmine-1.0.4)
    rake aborted!
    Access denied for user 'admin'@'localhost' (using password: YES)

    (See full trace by running task with --trace)

    I actually have two instances of MySQL... And i think its this issue that is causing the prob...

    ReplyDelete
  6. Thanks, It worked fine ......Prasanna Yelsangikar

    ReplyDelete
  7. If you аге looking foг the bеѕt weіght lοss ρгoԁuct that woгk, Mеratol is ԁefinitely
    something that уou should tгy. Well, you ѕhould remember that thiѕ weight
    lоsѕ pill cοntains four powerful ingredients ωhich are scientifiсаlly provеn tο decreaѕe body weіght.
    all of these kіnds of benefitѕ ωere аvailable in onlу onе
    capsule.

    My blog does meratol work

    ReplyDelete
  8. We're now fully soaked to the new found glory of technology. And "do you ever think" means "would you will get involved again in a relationship, while you ended it. Someone that has a foot fetish usually likes a certain type of feet or footwear.

    Also visit my web blog; Breanne Benson

    ReplyDelete
  9. Youwill Never detect a reputed, dependable roofing company
    strength to the body structure of the firm. He's always finding a way to Induce two inches larger for the discredited domain. In yesteryear we just couldn't Verbalize up the very adjacent day with $300.
    00 in cash. Roofing Company PricesThere are variations even if
    you say alloy at the existing asphalt shingles.

    These expenses could be the drive of price immune to hot sun,
    ultraviolet illumination rays and ozone.

    Also visit my website :: solar installation los angeles

    ReplyDelete
  10. Benefits will in all probability be shown if applied 30 minuteѕ
    everу single dаy.

    Reviеw my blog; this website

    ReplyDelete
  11. I do also, but most of the time all of us just go about
    our organization oblivious to what is going on about us.

    Here is my weblog ... flex belt review

    ReplyDelete
  12. We would recommend stopping by the helpful site for a
    lot more information and facts.

    Also visit my webpage flex Belt coupon

    ReplyDelete