mysql外键设置错误代码: 1822 Failed to add the foreign key constraint. Missing index for constraint...
mysql外键设置时出现错误错误代码: 1822Failed to add the foreign key constraint. Missing index for constraint ‘演员参演电影_ibfk_2’ in the referenced table ‘电影’出现错误的sql语句:后来就去检查电影表,发现电影表的主键是电影名称+拍摄年份,而在演员参演电影中建立外键约束时,只选中电影名称或拍摄年份作为外键约束,导致不匹配。正确语句:将演员参演电影中的两列主键均加入到外键约束中,问