Mysql – Specified key was too long creating primary key

mariadbMySQL

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

Best Answer

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?).