Simple question: what is wrong here?
Using utf8 (CHARSET=utf8mb4) makes the internal fields larger.
What is the maximum field size for UTF8 keys? We need to guess?

create table repos(repo varchar (200), PRIMARY KEY (repo));
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

How hard is for mariadb to give a better error message?
btw: The answer, by trial and error, is 191 * 4 + 4 = 767.

mariadb Ver 15.1 Distrib 10.1.47-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

1 Answer 1


767 Limit in InnoDB Indexes lists 5 work arounds for the 767 problem.

But, these days, the preferred solution is to upgrade:

This problem exists before the limit was raised in 5.7.7 (MariaDB 10.2.2?).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.