script/generate acts_as_taggable_on_migration rake db:migrate 原因 Mysql::Error: Specified key was too long; max key length is 1000 bytes: CREATE INDEX `index_taggings_on_taggable_id_and_taggable_type_and_context` ON `taggings` (`taggable_id`, `taggable_type`, `context`) 我该怎么办? 这是我的数据库编码: mysql> SHOW VARIABLES LIKE 'character\_set\_%'; +————————–+——–+ | Variable_name | Value | +————————–+——–+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | utf8 | | […]
当我执行下面的命令: ALTER TABLE `mytable` ADD UNIQUE ( `column1` , `column2` ); 我得到这个错误信息: #1071 – Specified key was too long; max key length is 767 bytes 有关column1和column2的信息: column1 varchar(20) utf8_general_ci column2 varchar(500) utf8_general_ci 我认为varchar(20)只需要21个字节,而varchar(500)只需要501个字节。 所以总字节数是522,小于767.那么为什么我会得到错误信息呢? #1071 – Specified key was too long; max key length is 767 bytes