使用 MySQL Workbench 5.2 在表上执行更新命令时出错(错误代码:1175)

我正在使用 MySQL Server5.5,其中包含 MySQL Workbench 5.2 CE.我正在使用 MySQL Workbench 5.2 .我在数据库中有一个名为 user 的表.我在 MySQL Workbench 的 SQL Editor 上执行了以下命令:

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:

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.

推荐答案

每次你尝试更新mysql中的行时遇到这种错误,那是因为你尝试更新一个没有使用的WHERE的表KEY 列.

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.

你可以修复它,

SET SQL_SAFE_UPDATES=0;
UPDATE user SET email = 'abc@yahoo.com' WHERE email='ripon.wasim@yahoo.com';

或在工作台中

  • 编辑 -> 首选项 -> SQL 查询
  • 取消选中禁止不带 WHERE 子句的 UPDATE 和 DELETE 语句(安全更新)
  • 查询 --> 重新连接到服务器

相关文章