Why 'foreign key constraint fails' when foreign key exists?

岁酱吖の 提交于 2019-12-01 16:56:52
baklarz2048

I think it's a bug. MySQL shouldn't allow You to add FOREIGN KEY referencing to MyISAM table from InnoDB because MyISAM engine isn't transactional, InnoDb is.

Try:
ALTER TABLE t_timeoff_request ENGINE=InnoDB;

Foreign key constraints can't be applied to MyISAM engine.both table should use innodb engine for supporting foreign key constraints.

Maybe the problem is in another table, if you set a constraint on the FK. Did you set up a FK option, like ON UPDATE CASCADE?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!