Home >Database >Mysql Tutorial >MySQL防止delete命令删除数据的两种方法_MySQL

MySQL防止delete命令删除数据的两种方法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:25:261010browse

bitsCN.com

方法一
我常用的做法,就是在数据库中加一个删除标识字段,
如: isdel=1 这样就代码删除的字段了

方法二
直接限制mysql删除

启动MySQL的时候加上参数 -U

-U, --safe-updates  Only allow UPDATE and DELETE that uses keys.

他的作用是防止执行delete的时候没带有条件语句,如果没加上where则语句不执行。

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn