The MySQL default mode is Sql_safe_updates=1. In this mode, regardless of whether you are an update or delete row, the Where condition specifies the primary key. An error occurs if the Where condition only appears if it is not a primary key.
Example:
Set sql_safe_updates =1;--Start security update, this is the premise of my example.
--Step One: Build two tables
CREATE table t (x int,y int);
CREATE table t2 (x int primary key,y int);
--Step two: Insert data into the table
INSERT into t (x, Y) VALUES (2,2), (3,3);
INSERT into T2 (x, y) VALUES (2,2), (3,3);
--Step Three: test the effect of the security update mode on the update delete.
Update T set y =100 where x=1;--this will give an error, you are using Safe update mode ...
Update T2 set y=100 where x=1;--this is nothing. Because X is the primary key in this table T2, it is not in table T.
--Solutions:
In order to update the T-table can also be done, we need to add a sentence before the UPDATE statement.
Set Sql_safe_updates =0;--Disable this mode is possible .
MySQL, you is using Safe update mode