欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

MySQL中怎么防止無where條件的update操作

本篇文章為大家展示了MySQL中怎么防止無where條件的update操作,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。

成都創(chuàng)新互聯(lián)10年專注成都高端網(wǎng)站建設(shè)定制網(wǎng)站設(shè)計服務(wù),為客戶提供專業(yè)的成都網(wǎng)站制作,成都網(wǎng)頁設(shè)計,成都網(wǎng)站設(shè)計服務(wù);成都創(chuàng)新互聯(lián)服務(wù)內(nèi)容包含成都網(wǎng)站建設(shè),小程序開發(fā),軟件開發(fā),網(wǎng)絡(luò)營銷推廣,網(wǎng)絡(luò)運營服務(wù)及企業(yè)形象設(shè)計;成都創(chuàng)新互聯(lián)擁有眾多專業(yè)的高端網(wǎng)站制作開發(fā)團(tuán)隊,資深的高端網(wǎng)頁設(shè)計團(tuán)隊及經(jīng)驗豐富的架構(gòu)師高端網(wǎng)站策劃團(tuán)隊;我們始終堅持從客戶的角度出發(fā),為客戶量身訂造網(wǎng)絡(luò)營銷方案,解決網(wǎng)絡(luò)營銷疑問。


1、加-U登錄數(shù)據(jù)庫

點擊(此處)折疊或打開

  1. [root@master ~]# mysql -uroot -pmysql -U

  2. mysql: [Warning] Using a password on the command line interface can be insecure.

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

  4. Your MySQL connection id is 12

  5. Server version: 5.7.19-log Source distribution

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

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

  8. affiliates. Other names may be trademarks of their respective

  9. owners.

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

  11. mysql>

  12. mysql> use test;

  13. Reading table information for completion of table and column names

  14. You can turn off this feature to get a quicker startup with -A

  15. Database changed

  16. mysql> show tables;

  17. +----------------+

  18. | Tables_in_test |

  19. +----------------+

  20. | t1 |

  21. +----------------+

  22. 1 row in set (0.00 sec)

  23. mysql> show create table t1;

  24. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

  25. | Table | Create Table |

  26. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

  27. | t1 | CREATE TABLE `t1` (

  28.   `admin_id` int(11) NOT NULL DEFAULT '0',

  29.   `admin_name` varchar(200) NOT NULL,

  30.   `password` varchar(200) NOT NULL,

  31.   `role` int(11) NOT NULL DEFAULT '1',

  32.   `last_login_time` datetime DEFAULT NULL,

  33.   `last_login_ip` varchar(16) DEFAULT '',

  34.   `admin_status` int(11) NOT NULL DEFAULT '1',

  35.   `create_time` datetime DEFAULT NULL

  36. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |

  37. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

  38. 1 row in set (0.00 sec)

  39. mysql> update t1 set admin_status=1234;

  40. ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

此處可以看到數(shù)據(jù)庫給出了提示,不允許沒有where條件的update操作。
2、根據(jù)這樣的特性,對系統(tǒng)環(huán)境變量進(jìn)行更改
vi /etc/profile
alias mysql='mysql -U'
source /etc/profile
3、正常命令登錄MySQL,進(jìn)行測試

點擊(此處)折疊或打開

  1. [root@master ~]# mysql -uroot -pmysql

  2. mysql: [Warning] Using a password on the command line interface can be insecure.

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

  4. Your MySQL connection id is 14

  5. Server version: 5.7.19-log Source distribution

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

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

  8. affiliates. Other names may be trademarks of their respective

  9. owners.

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

  11. mysql> use test;

  12. Reading table information for completion of table and column names

  13. You can turn off this feature to get a quicker startup with -A

  14. Database changed

  15. mysql> update t1 set admin_status=1234;

  16. ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

上述內(nèi)容就是MySQL中怎么防止無where條件的update操作,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

網(wǎng)頁名稱:MySQL中怎么防止無where條件的update操作
轉(zhuǎn)載源于:http://chinadenli.net/article42/jgcshc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機、網(wǎng)站導(dǎo)航、營銷型網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計公司、品牌網(wǎng)站設(shè)計App設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計公司