Contents
Why is the specified key too long in MySQL?
Specified key was too long; max key length is 767 bytes this has nothing to do with innodb_large_prefix ON or OFF, but is only related to the size of a single VARCHAR column being used as an index. and you get the previous error, as the max key length for a single column is 767 bytes for an InnoDB table. A VARCHAR (255) is ok, because:
What is the error code for specified key was too long?
Error Code: 1071. Specified key was too long; max key length is 767 bytes this has nothing to do with innodb_large_prefix ON or OFF, but is only related to the size of a single VARCHAR column being used as an index. and you get the previous error, as the max key length for a single column is 767 bytes for an InnoDB table.
How long is the max key length in SQL?
SQL Error #1071 – Specified key was too long; max key length is 767 bytes
Why is the specified key too long in InnoDB?
Specified key was too long; max key length is 767 bytes this has nothing to do with innodb_large_prefix ON or OFF, but is only related to the size of a single VARCHAR column being used as an index. and you get the previous error, as the max key length for a single column is 767 bytes for an InnoDB table.
What is the length of a specified key?
ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes. That’s sloppy code but the bottom line is that my answer doesn’t actually fix this problem.
You’ll need to reduce the size of the the fields that make up the primary key or you can upgrade MySQL version to the latest release. Also see this other question: Error: Specified key was too long; max key length is 1000 bytes. This common problem mostly occurs because by default MySql uses character limit for column names.
How big is the primary key in MySQL?
PRIMARY KEY (realurl,catagory) has a size of (200 + 200) * 3 = 1,200 bytes, which is greater than the 1,000 byte limit, as MySQL stores utf8 encoded chars as 3 bytes. You’ll need to reduce the size of the the fields that make up the primary key or you can upgrade MySQL version to the latest release.
What to do if your primary key is too long?
That should direct you on how to adjust key lengths, especially your PRIMARY KEYs. If you know which table is causing the Error 1071, you have to do the following: Step 03) Using vi or some other editor, edit the table’s PRIMARY KEY to manually limit the PRIMARY KEY in such a way that the key does not exceed 1000 characters.