mysql 帮助说明

1[oldboy_c64 ~]# mysql --help|grep dummy

2 -U, --i-am-a-dummy Synonym for option --safe-updates, -U.

3i-am-a-dummy       FALSE

在 mysql 命令加上选项-U 后,当发出没有 WHERE 或 LIMIT 关键字的 UPDATE 或 DELETE 时,

mysql 程序就会拒绝执行

[oldboy_c64 ~]# mysql -uroot -poldboy123 -S /data/3306/mysql.sock –U

1

Welcome to the MySQL monitor. Commands end with ; or \g.

2

Your MySQL connection id is 14

3

Server version: 5.5.32-log MySQL Community Server (GPL)

4

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

5

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

6

affiliates. Other names may be trademarks of their respective

7

owners.

8

Type 'help;' or '\h' for help. Type '\c' to
clear the current input statement.

9

mysql> delete from oldboy.student;

10

ERROR 1175 (HY000): You are using safe update mode and you tried to update a

11

table without a
WHERE that uses a KEY column

12

mysql> quit

13

Bye

103

提示:不加条件无法删除,目的达到。

3、做成别名防止老大和 DBA 误操作

1  [oldboy_c64 ~]# alias mysql='mysql -U'

2  [oldboy_c64 ~]# mysql -uroot -poldboy123 -S /data/3306/mysql.sock

3  Welcome to the MySQL monitor. Commands end with ; or \g.

4  Your MySQL connection id is 15

5  Server version: 5.5.32-log MySQL Community Server (GPL)

6  Type 'help;' or '\h' for help. Type '\c' to
clear the current input statement.

7  mysql> delete from oldboy.student;

8  ERROR 1175 (HY000): You are using safe update mode and you tried to update a

9  table without a WHERE that uses a
KEY column

10mysql> delete from oldboy.student where Sno=5;

11Query OK, 1 row affected (0.02 sec)

12mysql> quit

104

13Bye

14[oldboy_c64 ~]# echo "alias mysql='mysql -U'" >>/etc/profile

15[oldboy_c64 ~]# . /etc/profile

16[oldboy_c64 ~]# tail -1 /etc/profile

alias mysql='mysql -U'
结论:

在 mysql 命令加上选项-U 后,当发出没有 WHERE 或 LIMIT 关键字的 UPDATE 或 DELETE 时,

mysql 程序拒绝执行

最新文章

  1. 优化SQL查询:如何写出高性能SQL语句
  2. libusb-win32简介~
  3. 2016年10月10日--穷举、迭代、while循环
  4. javascript 搜索并高亮显示
  5. 六个创建模式之抽象工厂模式(Abstract Factory Pattern)
  6. logistic regression的一些问题,不平衡数据,时间序列,求解惑
  7. nagios plugin 开发
  8. HD1013Digital Roots
  9. sublime text3的一些小技巧记录(配gif图)
  10. 诺基亚HERE地图
  11. thinkphp的目录结构设计经验总结
  12. VideoView的视频的全屏播放
  13. MyBatis《1》
  14. txt文件按行处理工具类(可以截取小说、分析日志等)【我】
  15. selenium缺少chromedriver解决方法
  16. BZOJ3812 主旋律(状压dp+容斥原理)
  17. Android面试、开发之高手 编码规范与细节
  18. c 预处理的宏定义
  19. java中线程同步问题
  20. CMD一般命令

热门文章

  1. Spring Data Jpa (三)定义查询方法
  2. (四)mysql -- 常用函数
  3. python面向对象之设计模式
  4. react注
  5. java统计文档中相同字符出现次数(超详细)
  6. legend3---Windows 7/8/10 系统下Laravel框架的开发环境安装及部署详解(Vagrant + Homestead)
  7. jQuery file upload里面的_create的调用和_initEventHandlers的调用
  8. soj#2402 「THUPC 2017」天天爱射击 / Shooting
  9. 电脑出现了一块tap window adapter v9 网卡 以及虚拟机桥接模式无法通信原因
  10. 六、RF中断言关键字使用详解