MySQL error code: 1175 during UPDATE in MySQL Workbench

前端 未结 20 1292
隐瞒了意图╮
隐瞒了意图╮ 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:50

    This is for Mac, but must be same for other OS except the location of the preferences.

    The error we get when we try an unsafe DELETE operation

    On the new window, uncheck the option Safe updates

    Then close and reopen the connection. No need to restart the service.

    Now we are going to try the DELETE again with successful results.

    So what is all about this safe updates? It is not an evil thing. This is what MySql says about it.

    Using the --safe-updates Option

    For beginners, a useful startup option is --safe-updates (or --i-am-a-dummy, which has the same effect). It is helpful for cases when you might have issued a DELETE FROM tbl_name statement but forgotten the WHERE clause. Normally, such a statement deletes all rows from the table. With --safe-updates, you can delete rows only by specifying the key values that identify them. This helps prevent accidents.

    When you use the --safe-updates option, mysql issues the following statement when it connects to the MySQL server:

    SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;
    

    It is safe to turn on this option while you deal with production database. Otherwise, you must be very careful not accidentally deleting important data.

提交回复
热议问题