mysql更换版本为5.7后,执行删除记录操作报错
报错如下:
Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences
原因:
mysql为了提高数据库的安全性能,默认使用了safe-updates模式,在该模式下,对数据表进行update和delete时必须要用where语句而且必须带有该表的主键约束。
解决方法:
更改mysql的默认模式
SET SQL_SAFE_UPDATES=0
注意:
该命令“=”两边不能有空格,不然会报错