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