0

Possible Duplicate:
“Specified key was too long; max key length is 1000 bytes”

SQL query:

CREATE TABLE  `freecomputermarket`.`Members` (

`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`UserName` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`Email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`Password` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`BirthDate` DATE NOT NULL ,
`RegisterationDate` DATE NOT NULL ,
`ActivationCode` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`ActivationLink` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`IsActive` BIT( 0 ) NOT NULL ,
`Gender` CHAR( 6 ) NOT NULL ,
UNIQUE (
`UserName` ,
`ActivationCode` ,
`ActivationLink`
)
) ENGINE = MYISAM

when i am executing this query an error "#1071 - Specified key was too long; max key length is 1000 bytes" raised?

Community
  • 1
  • 1
  • 1
    Duplicate: http://stackoverflow.com/questions/1037598/specified-key-was-too-long-max-key-length-is-1000-bytes http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes/ http://stackoverflow.com/questions/10642429/error-1071-specified-key-was-too-long-max-key-length-is-1000-bytes-mysql http://stackoverflow.com/questions/8923854/max-key-length-is-1000-bytes http://stackoverflow.com/questions/8746207/1071-specified-key-was-too-long-max-key-length-is-1000-bytes and more...just use the search. – Jocelyn Sep 26 '12 at 19:53

1 Answers1

4

You have three 255-character UTF8 columns in your UNIQUE index. Each UTF8 character can take up to 3 bytes, so each column can take up to 765 bytes, which makes a total of 2295 bytes for your entire index, which as the error states, is over the limit of 1000 bytes.

lanzz
  • 42,060
  • 10
  • 89
  • 98