Mysql 5.7.9 shutdown 語法實例詳解
mysql-5.7.9 終于提供shutdown 語法啦:
之前如果想關閉一個mysql數(shù)據(jù)庫可以通過kill 命令、mysqladmin shutdown 、service mysqld stop 等這樣的方式。
然而在mysql-5.7.9之后mysql終于提供了SQL接口的shutdown語法啦!
SQL接口下的shutdown語法:
語法
shutdown ; -- 這個shutdown要執(zhí)行成功要有shutdown權限才行。
shutdown的一個例子:
[root@workstudio ansible]# mysql -uroot -h127.0.0.1 -- 登錄進mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.18-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> shutdown ; -- 通過SQL接口的方式執(zhí)行shutdown Query OK, 0 rows affected (0.00 sec) -- 在mysql客戶端下執(zhí)行system 來執(zhí)行l(wèi)inux命令 這里用ps來查看linux上有沒有mysqld 這個服務程序了 mysql> system ps -ef | grep mysql root 5709 3403 0 13:32 pts/0 00:00:00 mysql -uroot -h127.0.0.1 root 5720 5709 0 13:33 pts/0 00:00:00 sh -c ps -ef | grep mysql root 5722 5720 0 13:33 pts/0 00:00:00 grep mysql -- 由ps的結(jié)果可以看出mysql數(shù)據(jù)庫已經(jīng)關閉了(mysqld這個進程沒有了)
如果權限不足會看下如下效果:
mysql> shutdown; ERROR 1227 (42000): Access denied; you need (at least one of) the SHUTDOWN privilege(s) for this operation
由于shutdown是實例級的權限、所以授權語句如下:
mysql> grant shutdown on *.* to jiangle@‘localhost‘ ; Query OK, 0 rows affected, 1 warning (0.00 sec) -- 授予jiangle@‘localhost‘用戶shutdown權限
以上所述是小編給大家介紹的Mysql 5.7.9 shutdown 語法實例詳解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- Centos 7下使用RPM包安裝MySQL 5.7.9教程
- 解決MySQL 5.7.9版本sql_mode=only_full_group_by問題
- MySQL 5.7.9 服務無法啟動-“NET HELPMSG 3534”的解決方法
- mysql 5.7.9 免安裝版配置方法圖文教程
- MYSQL5.7.9開啟慢查詢?nèi)罩镜募记?/a>
- Mysql5.7修改root密碼教程
- mysql5.7及mysql 8.0版本修改root密碼的方法小結(jié)
- Windows10下MySQL5.7.19安裝教程 MySQL忘記root密碼修改方法
- MySQL 5.7忘記root密碼后修改的詳細教程
- 更新至MySQL 5.7.9的詳細教程
相關文章
mysql事務select for update及數(shù)據(jù)的一致性處理講解
今天小編就為大家分享一篇關于mysql事務select for update及數(shù)據(jù)的一致性處理講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-03-03mysql between實現(xiàn)選取介于兩個值之間的數(shù)據(jù)范圍
這篇文章主要介紹了mysql between實現(xiàn)選取介于兩個值之間的數(shù)據(jù)范圍,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-07-07