MySQL error code: 1175 during UPDATE (MySQL-Workbench vs. console)

后端 未结 3 473
执念已碎
执念已碎 2021-01-21 12:54

Am very aware of that this issue can be resolved with disabling safe update mode enabled (e.g. see here: MySQL error code: 1175 during UPDATE in MySQL Workbench). However, I do

相关标签:
3条回答
  • 2021-01-21 13:13

    From https://dev.mysql.com/doc/workbench/en/workbench-faq.html#faq-workbench-delete-safe

    By default, Workbench is configured to not execute DELETE or UPDATE queries that do not include a WHERE clause on a KEY column.

    Such configuration prevents you from deleting or updating table mistakenly, since you are doing a batch update on data without a key.

    To resolve this, as you may be already aware the following options.

    1. Open your Workbench Preferences, select the SQL Editor section, and disable the following preference: "Safe Updates" - Forbid UPDATEs and DELETEs with no key in WHERE clause or no LIMIT clause.
    2. Run SET SQL_SAFE_UPDATES=0;
    0 讨论(0)
  • 2021-01-21 13:18

    If you are using workbech, you can first execute

    SET SQL_SAFE_UPDATES = 0;
    

    And then execute delete statement

    0 讨论(0)
  • 2021-01-21 13:39

    If you want to still update your data with safe update on, you must retool your where clause so that it includes references to the table's primary key(s). See this page.

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