首页 文章

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

提问于
浏览
15

我使用MySQL Workbench 5.2 . 我在DB中有一个名为 user 的表 . 我在MySQL Workbench上的SQL编辑器上执行了以下命令:

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

但不幸的是我收到了以下错误:

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.

怎么了?非常感谢帮助 .

2 回答

  • 29

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

    你可以使用,修复它,

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

    或在WorkBench中

    • 编辑 - >首选项 - > SQL查询

    • 取消选中没有WHERE子句的禁止UPDATE和DELETE语句(安全更新)

    • 查询 - >重新连接到服务器

    enter image description here

  • 0

    停用和重新激活更为正确

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

相关问题