且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL InnoDB约束不起作用

更新时间:2023-01-30 11:34:59

如果致电

SET FOREIGN_KEY_CHECKS=0;

,则FK检查关闭。谁知道,这可能是你的系统的状态现在。让他们开启

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;

请注意以下事项。只是重新打开检查不会重新验证参照完整性。需要 ALTER TABLE

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

只需发布一个模式,

意思是,我可以关闭我的约束,使用系统,删除一些数据,做LOAD DATA INFILE(简单的搞乱我的数据),然后运行到***并且说gosh是怎么发生的。

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 *** 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.