Recently I was performing one very simple MySQL query. But I am not getting success for that query. So after few mins of research I am found the solution for that.
Actually my query was just like below:
Isn’t it so simple? yes it is. But it was not working. Once I have started to debug the process I found that MySQL is throwing the below error:
“You are using safe update mode and you tried to update a table without a WHERE clause that uses a KEY column.”
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.
So below query will also be refused if safe mode is enabled:
There is a simple way to disable the MySQL Safe Mode. We can disable it with simple query.
Have a look at below query:
Note: MySQL will also refuse the query which have WHERE clause but there is no condition with the KEY column.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash