2

I want to create 2 tables on some machine where I downloaded mysql, and I get error when trying to create them:

CREATE TABLE Manager (
    managerId int NOT NULL AUTO_INCREMENT,
    name varchar(255) NOT NULL,
    UNIQUE (name),
    PRIMARY KEY (managerId)
);

this one fail cause of the unique from some reason...on my local machine didnt have this issue.

 CREATE TABLE Contact (
    managerId int NOT NULL,
    contactName varchar(255) NOT NULL,
    PRIMARY KEY (contactName, managerId),
    FOREIGN KEY (managerId) REFERENCES Manager(managerId)
);

this one fail cause the compound pr key PRIMARY KEY (contactName, managerId)

both throw an error:

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

if i delete the unique and the compound primary key it work...why is happening? :/

  • Possible duplicate of [#1071 - Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes) – rochy_01 Feb 15 '18 at 14:31

0 Answers0