I'm using MySQL Server5.5 in which MySQL Workbench 5.2 CE is included. I'm using MySQL Workbench 5.2 . I have a table named user in DB. I executed the following command on SQL Editor at MySQL Workbench:
我正在使用MySQL Server5.5,其中包含MySQL Workbench 5.2 CE。我使用的是MySQL Workbench 5.2。我在DB中有一个名为user的表。我在MySQL Workbench对SQL Editor执行了以下命令:
UPDATE user SET email = 'abc@yahoo.com' WHERE email='ripon.wasim@yahoo.com';
But unfortunately I got the following error:
但不幸的是,我犯了以下错误:
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 Editor -> Query Editor and reconnect.
What's the wrong? Help is highly appreciated.
是什么错了吗?帮助是高度赞赏。
1 个解决方案
#1
29
Every time you encountered that kind of error when trying to update rows in mysql, It’s because you tried to update a table without a WHERE that uses a KEY
column.
每次当您试图更新mysql中的行时,都会遇到这样的错误,因为您试图更新一个没有使用键列的表。
You can fix it using,
你可以用,
SET SQL_SAFE_UPDATES=0;
UPDATE user SET email = 'abc@yahoo.com' WHERE email='ripon.wasim@yahoo.com';
or in the WorkBench
或在工作台
- Edit -> Preferences -> SQL Queries
- 编辑->偏好-> SQL查询。
- Uncheck Forbid UPDATE and DELETE statements without a WHERE clause (safe updates)
- Uncheck禁止在没有WHERE子句(安全更新)的情况下更新和删除语句
- Query --> Reconnect to Server
- 查询——>重新连接到服务器。
#1
29
Every time you encountered that kind of error when trying to update rows in mysql, It’s because you tried to update a table without a WHERE that uses a KEY
column.
每次当您试图更新mysql中的行时,都会遇到这样的错误,因为您试图更新一个没有使用键列的表。
You can fix it using,
你可以用,
SET SQL_SAFE_UPDATES=0;
UPDATE user SET email = 'abc@yahoo.com' WHERE email='ripon.wasim@yahoo.com';
or in the WorkBench
或在工作台
- Edit -> Preferences -> SQL Queries
- 编辑->偏好-> SQL查询。
- Uncheck Forbid UPDATE and DELETE statements without a WHERE clause (safe updates)
- Uncheck禁止在没有WHERE子句(安全更新)的情况下更新和删除语句
- Query --> Reconnect to Server
- 查询——>重新连接到服务器。