I have a problem in converting all my tables' charset latin1 to utf8. Maximum tables are converted but some tables showed that
ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes
Here in my table I am using primary key with an 3 elements. The elements length is 128,64,开发者_StackOverflow128 respectively. Can anybody solve this? Advanced thank you.
i federated this table.from another database.the base table engine is MYISAM.
In MySQL
, UTF8
characters can take up to 3
bytes.
Hence, the max length of your PK can be (128 + 64 + 128) * 3 = 960
bytes which exceeds 255
bytes allowed by the engine.
BTW, what storage engine are you using? InnoDB
allows 767
bytes and MyISAM
allows 1000
bytes.
精彩评论