mysql臨時取消外鍵約束方法

當表有外鍵約束的時候,無法更新字段和清空表,使用SET foreign_key_checks可以取消外鍵約束

SET foreign_key_checks=0;
truncate table ailiyuninfo_serverinfo;
truncate table opsweb_hostprivileges;
truncate table opsweb_hostprivileges_alias;
SET foreign_key_checks=1;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章