什么是安全模式 在mysql中,如果在update和delete没有加上where条件,数据将会全部修改.不只是初识mysql的开发者会遇到这个问题,工作有一定经验的工程师难免也会忘记写入where条件.为了避免失误造成的数据全部修改和删除,可开启mysql的安全模式. 安全模式的开启: mysql> show variables like 'sql_safe_updates'; +------------------+-------+ | Variable_name | Value | +--…
MYSQL安全模式 Mysql版本: 背景: 为了避免在执行delete.update将全表数据清空或者覆盖修改,在新项目营销云中开启了mysql的安全模式. 安全模式要求不能对非主键的条件查询做update和delete操作 SET ; 开启后出现的报错: 在修改跟删除数据时候,没有加where语句.或者加了where语句 where中没有使用索引列,导致SQL执行失败,后台项目报错,报错内容: [Err] - You are using safe update mode and you tr…
今天,执行一条delete语句的时候报错如下: Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 大意是:数据库运行在safe update…