2014-11-13 97 views
1

我試圖將現有的數據庫導入到我們正在開發的新的rails應用程序中。我使用rake db:schema dump成功轉儲我的數據庫的模式。每當我試圖轉儲使用rake db:data:dump我的數據,耙以下輸出中止:Ruby on Rails MySQL數據庫遷移中止耙

rake db:data:dump --trace 
** Invoke db:data:dump (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Execute db:data:dump 
rake aborted! 
ActiveRecord::StatementInvalid: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key LIMIT 1000 OFFSET 0' at line 1: SELECT * FROM `hypqd_akeeba_common` ORDER BY key LIMIT 1000 OFFSET 0 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `query' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `block in execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:464:in `block in log' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.0.beta4/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:458:in `log' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/mysql2_adapter.rb:225:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/mysql2_adapter.rb:229:in `exec_query' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:340:in `select' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:184:in `block in each_table_page' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:182:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:182:in `each_table_page' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/yaml_db.rb:47:in `dump_table_records' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:167:in `dump_table' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:150:in `block in dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:148:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:148:in `dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:14:in `dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:240:in `call' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:235:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' 
/Users/awernick/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:75:in `run' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/bin/rake:33:in `<top (required)>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>' 
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key LIMIT 1000 OFFSET 0' at line 1 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `query' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `block in execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:464:in `block in log' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.0.beta4/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:458:in `log' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:297:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/mysql2_adapter.rb:225:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/mysql2_adapter.rb:229:in `exec_query' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:340:in `select' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:184:in `block in each_table_page' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:182:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:182:in `each_table_page' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/yaml_db.rb:47:in `dump_table_records' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:167:in `dump_table' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:150:in `block in dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:148:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:148:in `dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/serialization_helper.rb:14:in `dump' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/yaml_db-0.3.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:240:in `call' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:235:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' 
/Users/awernick/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `each' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/lib/rake/application.rb:75:in `run' 
/Users/awernick/.rvm/gems/ruby-2.1.5/gems/rake-10.3.2/bin/rake:33:in `<top (required)>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval' 
/Users/awernick/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>' 
Tasks: TOP => db:data:dump 

我檢查我的架構,我無法找到任何有關語法錯誤key LIMIT 1000 OFFSET 0' at line 1: SELECT * FROM ``hypqd_akeeba_common`` ORDER BY key LIMIT 1000 OFFSET 0

是什麼原因造成耙放棄?

回答

0

我能解決這個問題。這個問題與耙子甚至mysql無關。我的數據庫沒有從phpmyadmin原始數據庫中正確轉儲。重新整理數據庫後,所有工作都正常。