[MySQL] MySQL Safe Update Mode Explained

What is MySQL Safe Mode?
MySQL will refuse to run the UPDATE or DELETE query if executed without the WHERE clause or LIMIT clause.
MySQL will also refuse the query which have WHERE clause but there is no condition with the KEY column.

How to disable MySQL Safe Mode?
There is a simple way to disable the MySQL Safe Mode.
We can disable it with simple query.

Have a look at below query:
SET SQL_SAFE_UPDATES=0;UPDATE table_name SET field_name1 =0 WHERE field_name2 ='abc';

Note: MySQL will also refuse the query which have WHERE clause but there is no condition with the KEY column
ref link: http://www.xpertdeveloper.com/2011/10/mysql-safe-update/

留言