当表有外键约束的时候,无法更新字段和清空表,使用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;