bflower-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org
2009-Feb-09 10:11 UTC
db:migrate and Mysql error
Hi, Am getting the error "undefined method `each'' for #<Mysql:0x483f2d0>" when I try to run a "rake db:migrate" on a very simple example for a Mysql database. This follows a very basic setup procedure that works with sqlite3, but fails when I try to use Mysql (note that I have verified that the db on mysql is created and accessible to rails)>rails photos >cd photos >ruby script/generate scaffold photo filename:string thumbnail:string description:string >rake db:migrateat this point I get an error (see below). Note that the schema_migrations table is created and if I run the rake command then the table photos is also created (but I get a command out of sequence error from rails). I have read relevant posts regarding versions of mysql and libmysql.dll which I have taken action on. I would appreciate any clues as it is driving me nuts %). I am using: MS Windows XP Home Ediition Version 2002 SP3 ruby ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] rails 2.2.2 mysql gem 2.7.3 Mysql 5.1.31-community Cheers Barry The trace is as follows: C:\rails\photos>C:\rails\photos>rake db:migrate --trace (in C:/rails/photos) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! undefined method `each'' for #<Mysql:0x483f2d0> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/mysql_adapter.rb:414:in `tables'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/schema_statements.rb:330:in `initialize_schema_migrations_table'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:430:in `initialize'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:394:in `new'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:394:in `up'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:377:in `migrate'' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake: 111 C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'' C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31 C:/Ruby/bin/rake:19:in `load'' C:/Ruby/bin/rake:19 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 9, 10:11 am, "bflo...-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org" <bflo...-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org> wrote:> I have read relevant posts regarding versions of mysql and > libmysql.dll which I have taken action on. > I would appreciate any clues as it is driving me nuts %). > > I am using: > MS Windows XP Home Ediition Version 2002 SP3 > ruby ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] > rails 2.2.2 > mysql gem 2.7.3 > Mysql 5.1.31-community >I recall vaguely seeing messages about this previously with the end result being that mysql 5.1.x was the problem. Fred> Cheers > Barry > > The trace is as follows: > C:\rails\photos>C:\rails\photos>rake db:migrate --trace > (in C:/rails/photos) > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > rake aborted! > undefined method `each'' for #<Mysql:0x483f2d0> > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > connection_adapters/mysql_adapter.rb:414:in `tables'' > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > connection_adapters/abstract/schema_statements.rb:330:in > `initialize_schema_migrations_table'' > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > migration.rb:430:in `initialize'' > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > migration.rb:394:in `new'' > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > migration.rb:394:in `up'' > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > migration.rb:377:in `migrate'' > C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake: > 111 > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in > `invoke_with_call_chain'' > C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in > `invoke_with_call_chain'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in > `invoke_task'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in > `top_level'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in > `top_level'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in > `standard_exception_handling'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in > `top_level'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in > `standard_exception_handling'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'' > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31 > C:/Ruby/bin/rake:19:in `load'' > C:/Ruby/bin/rake:19--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bflower-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org
2009-Feb-11 11:21 UTC
Re: db:migrate and Mysql error
Discovered the solution elsewhere and thanks to fred who provide enough of an addition clue to hunt down other oblique references to the problem: The problem is that libmysql.dll shipped with Mysql 5.1 doesn''t play well with ruby 2.2.. The solution is to download the libmysql.dll from: http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll and save this in your ruby bin directory see also: http://forums.aptana.com/viewtopic.php?f=20&t=7563&p=27407&hilit=libmysql.dll#p27407 On Feb 9, 9:50 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Feb 9, 10:11 am, "bflo...-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org" <bflo...-4iK2G3VhlDjvnOemgxGiVw@public.gmane.org> > wrote: > > > I have read relevant posts regarding versions ofmysqland > > libmysql.dll which I have taken action on. > > I would appreciate any clues as it is driving me nuts %). > > > I am using: > > MS Windows XP Home Ediition Version 2002 SP3 > > ruby ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] > > rails 2.2.2 > > mysqlgem 2.7.3 > > Mysql5.1.31-community > > I recall vaguely seeing messages about this previously with the end > result being thatmysql5.1.x was the problem. > > Fred > > > Cheers > > Barry > > > The trace is as follows: > > C:\rails\photos>C:\rails\photos>rake db:migrate --trace > > (in C:/rails/photos) > > ** Invoke db:migrate (first_time) > > ** Invoke environment (first_time) > > ** Execute environment > > ** Execute db:migrate > > rake aborted! > > undefined method `each'' for #<Mysql:0x483f2d0> > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > connection_adapters/mysql_adapter.rb:414:in `tables'' > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > connection_adapters/abstract/schema_statements.rb:330:in > > `initialize_schema_migrations_table'' > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > migration.rb:430:in `initialize'' > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > migration.rb:394:in `new'' > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > migration.rb:394:in `up'' > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ > > migration.rb:377:in `migrate'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake: > > 111 > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in > > `invoke_with_call_chain'' > > C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in > > `invoke_with_call_chain'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in > > `invoke_task'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in > > `top_level'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in > > `top_level'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in > > `standard_exception_handling'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in > > `top_level'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in > > `standard_exception_handling'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'' > > C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31 > > C:/Ruby/bin/rake:19:in `load'' > > C:/Ruby/bin/rake:19--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---