[Solved] MySQL [Err] 1071 – Specified key was too long; max key length is 767 bytes

2023/05/17 17:35

Error

MySQL [Err] 1071 – Specified key was too long; max key length is 767 bytes

Solution

Before MySQL 5.5.3, MySQL’s InnoDB engine requires that the primary key length must not exceed 767 bytes, and MySQL’s MyIsam engine requires that the primary key length must not exceed 1,000 bytes. so, you have two ways to solve this.
1. Modify the length of the union primary key to make it comply with the requirement.
2. Upgrade the MySQL version. Because the maximum length of the union primary key in MySQL version 5.7 is 3,072 bytes.

Leave a Reply

Back to top