Web#1215上的MySQL数据库-无法添加外键约束

当我尝试导入此表时,它显示此错误:

#1215 - Cannot add foreign key constraint

CREATE TABLE `Infos` (
      `i_id` int(11) NOT NULL AUTO_INCREMENT,
      `i_jour` date DEFAULT NULL,
      `heure_debut` datetime DEFAULT NULL,
      `heure_fin` datetime DEFAULT NULL,
      `u_id` int(4) DEFAULT NULL,
      `ouvrier_o_id` int(11) DEFAULT NULL,
      PRIMARY KEY (`i_id`),
      KEY `FK_Infos_u_id` (`u_id`),
      KEY `FK_Infos_ouvrier_o_id` (`ouvrier_o_id`),
      CONSTRAINT `FK_Infos_ouvrier_o_id` FOREIGN KEY (`ouvrier_o_id`) REFERENCES `ouvrier` (`o_id`),
      CONSTRAINT `FK_Infos_u_id` FOREIGN KEY (`u_id`) REFERENCES `utilisateur` (`u_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
评论