在使用MySQL Workbench进行批量更新或删除时,会出现如下错误:
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 -> SQL Queries and reconnect. 0.000 sec
因为是MySQL Workbench的默认的安全设置是不能批量更新表的。
解决方法:
一、在SQL语句之前添加
SET SQL_SAFE_UPDATES = 0;
二、修改MySQL Workbench设置:
- 打开Workbench的菜单[Edit]->[Preferences...]
- 切换到[SQL Queries]页面(不同版本可能在SQL Editor)
- “Safe Updates”.Forbid UPDATEs and DELETEs with no key in WHERE clause or no LIMIT clause.Requires a reconnection之前的对勾去掉.
- 点击【OK】,重启Workbench.
时间: 2024-11-01 06:41:10