MySQL InnoDB constraint does not work

谁说我不能喝 提交于 2019-12-02 05:03:39

If a call was made to

SET FOREIGN_KEY_CHECKS=0;

then FK checks are turned off. Who knows, that may be the state of your system right now. Have them turned on with

SET FOREIGN_KEY_CHECKS=1;

Note the following. Just turning checks back on does not re-validate the referential integrity. One needs ALTER TABLE for that.

Simply publishing a schema does little to say you are safeguarded.

Meaning, I could turn off my constraints, use the system, delete some data, do LOAD DATA INFILE (in short mess up my data), then run off to Stackoverflow with a schema and say "gosh how did this happen".

And it doesn't matter what state your system is in now. It matters what it was in back then.

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