MySQL error code: 1175 during UPDATE in MySQL Workbench

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

    On WorkBench I resolved it By deactivating the safe update mode:

    -Edit -> Preferences -> Sql Editor then uncheck Safe update.

    0 讨论(0)
  • 2020-11-22 10:47

    All that's needed is: Start a new query and run:

    SET SQL_SAFE_UPDATES = 0;
    

    Then: Run the query that you were trying to run that wasn't previously working.

    0 讨论(0)
  • 2020-11-22 10:48

    Follow the following steps before executing the UPDATE command: In MySQL Workbench

    1. Go to Edit --> Preferences
    2. Click "SQL Editor" tab and uncheck "Safe Updates" check box
    3. Query --> Reconnect to Server // logout and then login
    4. Now execute your SQL query

    p.s., No need to restart the MySQL daemon!

    0 讨论(0)
  • 2020-11-22 10:48
    1. Preferences...
    2. "Safe Updates"...
    3. Restart server

    0 讨论(0)
  • 2020-11-22 10:50

    The simplest solution is to define the row limit and execute. This is done for safety purposes.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题