MySQL error code: 1175 during UPDATE in MySQL Workbench

前端 未结 20 1004
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 09:58

I\'m trying to update the column visited to give it the value 1. I use MySQL workbench, and I\'m writing the statement in the SQL editor from inside the workben

相关标签:
20条回答
  • 2020-11-22 10:58

    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 and reconnect.

    Turn OFF "Safe Update Mode" temporary

    SET SQL_SAFE_UPDATES = 0;
    UPDATE options SET title= 'kiemvieclam24h' WHERE url = 'http://kiemvieclam24h.net';
    SET SQL_SAFE_UPDATES = 1;
    

    Turn OFF "Safe Update Mode" forever

    Mysql workbench 8.0:

    MySQL Workbench => [ Edit ] => [ Preferences ] -> [ SQL Editor ] -> Uncheck "Safe Updates"
    

    Old version can:

    MySQL Workbench => [Edit] => [Preferences] => [SQL Queries]
    
    0 讨论(0)
  • 2020-11-22 10:59

    If you are in a safe mode, you need to provide id in where clause. So something like this should work!

    UPDATE tablename SET columnname=1 where id>0
    
    0 讨论(0)
提交回复
热议问题