①在ap1上执行rake db:migrate RAILS_ENV="ris",从而向drizzle数据库中导入mry_production数据库。
这时出现如下的错误:
[root@rap1 mry]# rake db:migrate RAILS_ENV="ris"
(in /var/qp/mry)
RAILS_ENV
ris
== CreateContents: migrating =================================================
-- create_table(:contents, {:options=>"ENGINE=InnoDB DEFAULT CHARSET=utf8"})
rake aborted!
An error has occurred, all later migrations canceled:
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'CHARSET=utf8' at line 1: CREATE TABLE `contents` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY) ENGINE=InnoDB DEFAULT CHARSET=utf8
(See full trace by running task with --trace)
此处错误提示的意思是:在drizzle中,不支持"CHARSET=utf8"这样的语法。
经过调查,在dirzzle中等同于"CHARSET=utf8"的语法是"COLLATE='utf8_general_ci'"。
且在drizzle中创建表格后,其默认的COLLATE都为'utf8_general_ci'。
本文介绍了一种在使用rake任务将mry_production数据库迁移到Drizzle数据库时遇到的错误,并提供了详细的解决方案。错误主要源于创建表时的字符集设置语法不正确,文中给出了正确的Drizzle语法。
547

被折叠的 条评论
为什么被折叠?



