MySQL reports a 1175 error when deleting the updated data.

Source: Internet
Author: User

When you delete a record in the mysql database today, the following error message is displayed:

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.

After searching for information, I found that mysql has a variable named SQL _SAFE_UPDATES. For the security of database update operations, the default value is 1, so the update fails.

The following describes the values of SQL _SAFE_UPDATES when the variables are 0 and 1:

SQL _SAFE_UPDATES has two values: 0 and 1,

When SQL _SAFE_UPDATES = 1, the update and delete operation statements without the where and limit conditions cannot be executed, even the update and delete operations with the where and limit conditions but without the key column cannot be executed.

When SQL _SAFE_UPDATES = 0, the update and delete operations will be executed smoothly. Obviously, the default value of this variable is 1.

Therefore, when a 1175 error occurs, you can set the SQL _SAFE_UPDATES value to 0 and then perform the update. For example:

SQL _SAFE_UPDATES = 0;

Delete from testTable where name = 'zhangsan ';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.