can't create foreign key constraint

2019-08-03 16:30发布

问题:

CREATE TABLE share(
    `User_1` VARCHAR(50) NOT NULL,
    `User_2` VARCHAR(50) NOT NULL,
    PRIMARY KEY(`User_1`,`User_2`),
     CONSTRAINT `fk_1` FOREIGN KEY (`User_1`) REFERENCES user(`Dev_ID`)  ON DELETE RESTRICT ON UPDATE CASCADE ,
     CONSTRAINT `fk_2` FOREIGN KEY (`User_2`) REFERENCES user(`Dev_ID`)  ON DELETE RESTRICT ON UPDATE CASCADE 
);

I get this error:

{Foreign key constraint is incorrectly formed }

I want to make a link between user1 and user2.