SQL Error (1215): Cannot add foreign key constraint

前端 未结 2 1185
日久生厌
日久生厌 2021-01-28 15:04
CREATE TABLE `profilePic` (
    `ClientID` VARCHAR(255) NOT NULL,
    PRIMARY KEY (`ClientID`),
    CONSTRAINT `FK__user_details` FOREIGN KEY (`ClientID`) REFERENCES `us         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-28 15:27

    When trying to create a foreign key via HeidiSQL, you get a warning as soon as the selected column data types don't match. I added this warning to HeidiSQL's table designer due to the non-intuitive message from the server ("Cannot add foreign key constraint")

    The selected foreign column do not match the source columns data type and unsigned flag. This will give you an error message when trying to save this change. Please compare yourself:

提交回复
热议问题