MySQL Upgrade Table Failure After Upgrading to MySQL Server 8

I upgraded to MySQL 8 (from 5.7) on my laptop and was running into an error restoring a database table with a large varchar(2048) column:

ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes

The default character set in MySQL 8 is utf8mb4, which includes this restriction.

Changing the table character set to latin1 (to match 5.7) resolved the issue.

CREATE TABLE IF NOT EXISTS...
...
ENGINE=InnoDB CHARSET=latin1;

RE: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html

Leave a Reply

Your email address will not be published. Required fields are marked *