mysql防止误删除的方法

为了防止在更新和删除的时候,没有写where条件而对全部数据进行操作,mysql提供了一个参数来防止此情况的发生

需要在启动mysql的时候,增加参数--i-am-a-dummy含义是我是新手,或者使用-U

mysql -h 192.168.56.111 -u root -p --i-am-a-dummy

mysql>use test

mysql>update test.testtable set name='1';

error  1175:you are using safe update mode and you tried to update a table without a where  that  uses a KEY column.

会报错,提示在安全更新模式下不允许执行无where的语句。

原文地址:https://www.cnblogs.com/tippoint/p/3429562.html