1. sql_safe_updates
官方解释如下:
If set to 1, MySQL aborts UPDATE or DELETE statements that do not use a key in the WHERE clause or a LIMIT clause. (Specifically, UPDATE statements must have a WHERE clause that uses a key or a LIMIT clause, or both. DELETE statements must have both.) This makes it possible to catch UPDATE or DELETE statements where keys are not used properly and that would probably change or delete a large number of rows. The default value is 0.
默认为0,如果设置为1,则delete操作和update操作必须带有where子句,且where子句中的列必须是key或primary key,如果表设计的时候本来就没有设置key或primary key,则delete和update操作将不被允许,如果表设计的时候设置了key或者primary key,但where指定的是其它列,delete和update操作同样不被允许。
时间: 2024-11-10 08:27:04