> I have a problem when creating a table:
> CREATE TABLE test (
> test_key varchar(255) NOT NULL default '',
> test_value text NOT NULL,
> PRIMARY KEY (test_key) ) TYPE=MYISAM;
> It then report error:
> mySQL Error: Specified key was too long. Max key length is 500
> Why the varchar exceeded 500?
> I have a "set-variable = default-character-set=utf8" in my.cnf, maybe
> this is the cause of error?
> And is there way to increase this 500 value? Or I must use InnoDB then?
Apparently, the "500" number is "bytes". Assuming UTF8 takes
at least two bytes/character, then yes, your VARCHAR(255)
takes up more than 500 bytes.
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL