MySQL Error: The error 1175:you is using Safe update mode workaround

Source: Internet
Author: User

to manipulate the MySQL database, delete a row in the table to indicate the following error: ERROR 1175 (HY000): You is using Safe update mode and you tried to update a table without a WHERE that uses a KEY col Umn

error message: using the security update mode, try to update the Where condition where the table does not use the key column;


The reason is: MySQL has a variable called sql_safe_updates, for the security of the database update operation, this value defaults to 1, so the update failure occurs.


Examples are as follows:

Mysql> SELECT * from test;+----+--------+| ID |  Name |+----+--------+| 1 |  Anglea | | 2 |  Baby | | 3 |  Jerry | | 4 |  Tom | | 5 | Yong |+----+--------+mysql> Delete from test where name= ' Yong '; ERROR 1175 (HY000): You is using Safe update mode and you tried to update a table without a WHERE is uses a KEY column


To view the settings:

Mysql> Show variables like ' sql_safe% '; +------------------+-------+| variable_name | Value |+------------------+-------+| Sql_safe_updates | On |+------------------+-------+

The following is a description of the value of the sql_safe_updates variable of 0 and 1 o'clock:

The sql_safe_updates has two values of 0 and 1, or on and off;


sql_safe_updates = 1,on, UPDATE and delete operation statements without the where and limit conditions cannot be executed, even if there is a where and limit condition but without the key The update and delete of column cannot be executed either.

sql_safe_updates =0,off, the update and delete operations will execute smoothly. Then obviously, the default value for this variable is 1.

Therefore, when a 1175 error occurs, you can set the value of Sql_safe_updates to 0 OFF before performing the update;

The following 2 commands are available;

Mysql> set sql_safe_updates=0;

Mysql> set Sql_safe_updates=off;

Mysql> Show variables like ' sql_safe% '; +------------------+-------+| variable_name | Value |+------------------+-------+| Sql_safe_updates | OFF |+------------------+-------+mysql> Delete from test where name= ' Yong '; Query OK, 1 row Affected (0.00 sec)


The changes are only currently in effect, exit MySQL, and revert back to default after logging back in.


This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://mofansheng.blog.51cto.com/8792265/1694516

MySQL Error: The error 1175:you is using Safe update mode workaround

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.