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;

猜你喜欢

转载自blog.51cto.com/kexiaoke/2141020
今日推荐