In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about the failure of MySQL ERROR 1175 security mode UPDATE/DELETE operation. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
When doing some update or delete operations, an error will be reported:
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
It roughly means that when you try to manipulate the table using update (delete) in safe mode, there is no column with key written in the where condition.
For example, a table has two fields, where col_1 is the primary key, and the following operations are prohibited:
DELETE FROM table_name
DELETE FROM table_name LIMIT 5
DELETE FROM table_Name WHERE col_2=0
UPDATE table_name SET col_1=0
UPDATE table_name SET col_1=0 WHERE col_2=0
[solution]:
You can either disable this security mode or write sql as required to solve this problem:
0 disable the corresponding security mode:
This is actually caused by enabling the parameter sql_safe_updates. You can check this parameter:
Mysql > SELECT @ @ sql_safe_updates
+-+
| | @ @ sql_safe_updates |
+-+
| | 1 |
+-+
1 row in set (0.00 sec)
If temporarily disabled, you can dynamically modify the session-level mode directly:
Mysql > SET sql_safe_updates=0
Query OK, 0 rows affected (0.00 sec)
If you make permanent changes, you need to make changes in my.cnf:
Comment or delete the safe-updates parameter under [mysql] and log in to mysql-server via client again.
0 modify sql:
With sql_safe_updates enabled, if you need to use update/delete to manipulate a table, you must meet one of the following conditions:
In the DELETE operation:
① needs to specify the conditions of the column with key in the where, for example, here it can be WHERE col_1=0; (col_1 is the primary key).
Or
② needs to write the name of other non-key columns in where, and add limit restrictions
In the UPDATE operation:
① needs to specify limit limit
Or
② needs to write the conditions of columns with key in where.
Or
③ needs to write the name of other non-key columns in where, and add limit restrictions
This is what happens when the MySQL ERROR 1175 security mode UPDATE/DELETE operation fails, which is shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.