CREATE TABLE mini
(
realurl varchar(200) NOT NULL,
catagory varchar(200),
PRIMARY KEY (realurl,catagory),
FOREIGN KEY (realurl) REFERENCES main(realurl)
)
Error : `#1071 - Specified key was too long; max key length is 1000 bytes
Why I can't create this table? What should I change to create this table?
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.
Also see this other question: Error: Specified key was too long; max key length is 1000 bytes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With