Background:
Novice Operation Misoperation, delete my entire test list (test, no backup)
Operation Command:
mysql> Update test set name= ' Tom ';
The resulting result:
All the name columns of the test table become "Tom"
####################################
A bitter lesson, Baidu after help command found
[email protected] ~]# MySQL--help|grep dummy
-U,--i-am-a-dummy synonym for option--safe-updates,-U.
I-am-a-dummy FALSE
So the brain hole opens.
[[email protected] ~]# alias mysql= ' Mysql-u '
[[email protected] ~]# alias
Alias c= ' Clear '
Alias cp= ' Cp-i '
Alias l.= ' ls-d. *--color=auto '
Alias ll= ' Ls-l--color=auto '
Alias ls= ' ls--color=auto '
Alias mv= ' Mv-i '
Alias mysql= ' Mysql-u '
Alias rm= ' Rm-i '
Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '
[Email protected] ~]# echo "Alias mysql= ' Mysql-u '" >>/etc/profile
[Email protected] ~]# Source/etc/profile
Problem solving.
Note:-U is uppercase, you can specify this parameter when you log in later
Benefits:
Specify Login-u, in MySQL, perform the update and delete operations, and if no where or limit is specified, the program refuses to execute.
This article is from the "it--Brother" blog, please make sure to keep this source http://402753795.blog.51cto.com/10788998/1726011
MySQL security optimization using aliases to prevent mis-operation