开发者

problem in converting latin1 to utf8 for a table

开发者 https://www.devze.com 2023-03-20 02:31 出处:网络
I have a problem in converting all my tables\' charset latin1 to utf8. Maximum tables are converted but some tables showed that

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.

0

精彩评论

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