Home Error Code:1175. You are using safe update mode and you tried to update a table without a WHERE tha
Post
Cancel

Error Code:1175. You are using safe update mode and you tried to update a table without a WHERE tha

MySQL在执行删除、更新语句时报这种错误,是因为在MySQL处于safe-updates模式中,如果where后跟的条件不是主键id,那么就会提示这种错误。解决方式有两种。

  1. SET SQL_SAFE_UPDATES = 0;执行该命令更改MySQL数据库模式。
  2. 在where判断条件中跟上主键id,例如:delete from firstmysqldatabase.user where UserName='zhangsan' and ID>=0;

参考:Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE tha

This post is licensed under CC BY 4.0 by the author.