MySQL Restricted update or delete

Source: Internet
Author: User

After the MySQL command plus option-u, the MySQL program refuses to execute when an update or delete is issued without the Where or limit keyword

--1, MySQL help description

[user]# mysql --help

--2, specify-u logon test

[OLDBOY_C64 ~]# mysql-uroot-plu-s/data/3306/mysql.sock-u

Welcome to the MySQL Monitor. Commands End with; or \g.

Your MySQL connection ID is

Server version: 5.5. 32-log MySQL Community Server (GPL)

Copyright (c) , + , Oracle and /or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help; ' or ' \h '  for help. Type ' \c '  to Clear  the Current input statement.

mysql> Delete from Oldboy.student;

ERROR 1175 (HY000): You is using safe update mode and you tried Date a table without a WHERE that uses a KEY column

Mysql> quit

Bye

--3, alias to prevent the boss and DBA to operate by mistake

[OLDBOY_C64 ~]# alias mysql=' mysql-u '

[OLDBOY_C64 ~]# mysql-uroot-poldboy123-s/data/3306/mysql.sock

Welcome to the MySQL Monitor. Commands End with; or \g.

Your MySQL connection ID is

  server  version :   5.5 . 32-

Type ' help; ' or ' \h '  for help. Type ' \c '  to Clear  the Current input statement.

mysql> Delete from Oldboy.student;

  error   1175   (HY000):  you are   safe mode  and  you  Tried to  update  a table  without  a key  

mysql> Delete from Oldboy.student where sno=5;

Query OK, 1 row affected (0.02 sec)

Mysql> quit

Bye

[Oldboy_c64 ~]# echo "Alias mysql= ' Mysql-u '" >>/etc/ Profile

[Oldboy_c64 ~]#. /etc/ Profile

[Oldboy_c64 ~]# Tail-1 /etc/ profile


This article is from the "11920015" blog, please be sure to keep this source http://11930015.blog.51cto.com/11920015/1834171

MySQL Restricted update or delete

Related Article

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.