MySQL security optimization using aliases to prevent mis-operation

Source: Internet
Author: User
Tags aliases

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.