开发者

migrating simple rails database to mysql

i am interested in creating a rails app with a mysql database. i am new to rails and am just trying to start creating something simple:

rails -d mysql MyMoviesSQL
cd MyMoviesSQL
script/generate scaffold Movies title:string rating:integer
rake db:migrate

i am seeing the following error:

rake aborted!
NoMethodError: undefined method `ord' for 0:Fixnum: SET NAMES 'utf8'

if i do a trace:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
NoMethodError: undefined method `ord' for 0:Fixnum: SET NAMES 'utf8'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:599:in `configure_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:594:in `connect'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:203:in `initialize'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `new'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `mysql_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:435:in `initialize'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `new'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/ra开发者_如何学运维ke-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

here are my versions:

rails - 2.3.5
ruby - 1.8.6

gem list

*** LOCAL GEMS ***

actionmailer (2.3.5, 1.3.6)
actionpack (2.3.5, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 1.15.6)
activeresource (2.3.5)
activesupport (2.3.5, 1.4.4)
acts_as_ferret (0.4.1)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.9)
dbi (0.4.3)
deprecated (2.0.1)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.9.5, 0.3.8.4)
mongrel (1.1.4)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7, 0.7.3)
RedCloth (3.0.4)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.3.6)
rubynode (0.1.3)
sqlite3-ruby (1.2.1)
termios (0.9.4)

also, if i need to add a patch to FixNum, can someone please tell which file to add the patch to.

thanks for your help


installed the mysql gem

*** LOCAL GEMS ***

actionmailer (2.3.5, 1.3.6)
actionpack (2.3.5, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 1.15.6)
activeresource (2.3.5)
activesupport (2.3.5, 1.4.4)
acts_as_ferret (0.4.1)
autotest (4.2.9)
autotest-fsevent (0.2.2)
autotest-growl (0.2.3)
autotest-rails (4.1.0)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.9)
dbi (0.4.3)
deprecated (2.0.1)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.9.5, 0.3.8.4)
mongrel (1.1.4)
mysql (2.8.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7, 0.7.3)
RedCloth (3.0.4)
rspec (1.3.0)
rspec-rails (1.3.2)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.3.6)
rubynode (0.1.3)
sqlite3-ruby (1.2.1)
sys-uname (0.8.4)
termios (0.9.4)
ZenTest (4.3.1)

still occurring

rake db:migrate

rake aborted! NoMethodError: undefined method `ord' for 0:Fixnum: SET NAMES 'utf8'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜