當表有外鍵約束的時候,無法更新字段和清空表,使用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;
SET foreign_key_checks=0;
truncate table ailiyuninfo_serverinfo;
truncate table opsweb_hostprivileges;
truncate table opsweb_hostprivileges_alias;
SET foreign_key_checks=1;