Error code 1175: SQL Safe Updates parameter in MySQL

Avoid Update or delete without using where clause in MySQL

SQL_SAFE_UPDATES uses:
error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. By default disable.

For Enable:

mysql> set sql_safe_updates=1;
Query OK, 0 rows affected (0.00 sec)

mysql> update test set id = 3;
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.

For Disable:

mysql> set sql_safe_updates=0;
Query OK, 0 rows affected (0.00 sec)

mysql> update test set id = 3;
mysql> update test set id = 3;
Query OK, 0 rows affected (0.01 sec)
Rows matched: 2  Changed: 0  Warnings: 0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.