MySQL Error: Specified key was too long; max key length is 1000 bytes

When updating a MySQL database table to use UTF-8 I came across an error:

ERROR 1071 (42000) at line 1: Specified key was too long; max key length is 1000 bytes

Initial research indicates that the maximum key size in MySQL is 1000 bytes. Given that latin1 uses one (1) byte per character and UTF-8 uses three (3) bytes per character some indexes will exceed the 1000 byte limit. This accounts for the generated error when converting tables with large or compound indexes from latin1 to UTF8 encoding.

According to the MySQL bug tracker this issue has yet to be resolved. Currently the only solution is to limit indexing on UTF-8 encoded tables or use latin1 instead. Not the best of choices to say the least.

Sources:

MySQL Bugs: #4541: "Specified key was too long; max key length is 1000 bytes" with utf8
Character encoding

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.