溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

分析mysqld的skip-grant-tables選項(xiàng)

發(fā)布時(shí)間:2021-11-05 16:27:45 來源:億速云 閱讀:911 作者:iii 欄目:MySQL數(shù)據(jù)庫

這篇文章主要講解了“分析mysqld的skip-grant-tables選項(xiàng)”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“分析mysqld的skip-grant-tables選項(xiàng)”吧!

這個(gè)選項(xiàng)會(huì)導(dǎo)致不使用權(quán)限系統(tǒng)來啟動(dòng)服務(wù)器,它將讓任何用戶可以訪問服務(wù)器并且不受限制的訪問所有數(shù)據(jù)庫。在不使用授權(quán)表啟動(dòng)服務(wù)器后可以通過shell來執(zhí)行mysqladmin flush-privileges或mysqladmin reload命令或者在連接到服務(wù)器后執(zhí)行flush privileges語句來讓正在運(yùn)行的服務(wù)器再次使用授權(quán)表。

使用--skip-grant-tables選項(xiàng)啟動(dòng)服務(wù)器

[root@localhost mysql]# service mysqld stop
Shutting down MySQL. SUCCESS! 
[root@localhost mysql]# service mysqld start --skip-grant-tables
Starting MySQL.. SUCCESS!

現(xiàn)在就可以不使用用戶和密碼就可以登錄服務(wù)器

[mysql@localhost ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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>

現(xiàn)在可以執(zhí)行mysqladin flush-privileges命令讓正在運(yùn)行的服務(wù)器再次使用授權(quán)表

[mysql@localhost ~]$ mysqladmin  flush-privileges

現(xiàn)在不使用用戶和密碼就不能登錄服務(wù)器了,必須使用用戶和密碼才能登錄了

[mysql@localhost ~]$ mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[mysql@localhost ~]$ mysql -uroot -pabcd mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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.

再次使用--skip-grant-tables選項(xiàng)啟動(dòng)服務(wù)器

[root@localhost mysql]# service mysqld stop
Shutting down MySQL.. SUCCESS! 
[root@localhost mysql]# service mysqld start --skip-grant-tables
Starting MySQL.. SUCCESS!

現(xiàn)在就可以不使用用戶和密碼就可以登錄服務(wù)器

[mysql@localhost ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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>

現(xiàn)在可以執(zhí)行mysqladin reload命令讓正在運(yùn)行的服務(wù)器再次使用授權(quán)表

mysql@localhost ~]$ mysqladmin reload

現(xiàn)在不使用用戶和密碼就不能登錄服務(wù)器了,必須使用用戶和密碼才能登錄了

[mysql@localhost ~]$ mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[mysql@localhost ~]$ mysql -uroot -pabcd mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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.

再次使用--skip-grant-tables選項(xiàng)啟動(dòng)服務(wù)器

[root@localhost mysql]# service mysqld stop
Shutting down MySQL. SUCCESS! 
[root@localhost mysql]# service mysqld start --skip-grant-tables
Starting MySQL.. SUCCESS!

現(xiàn)在就可以不使用用戶和密碼就可以登錄服務(wù)器

[mysql@localhost ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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>

現(xiàn)在可以執(zhí)行flush privileges語句讓正在運(yùn)行的服務(wù)器再次使用授權(quán)表

mysql> flush privileges;
Query OK, 0 rows affected (0.12 sec)

現(xiàn)在不使用用戶和密碼就不能登錄服務(wù)器了,必須使用用戶和密碼才能登錄了

[mysql@localhost ~]$ mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[mysql@localhost ~]$ mysql -uroot -pabcd mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.26-log Source distribution
Copyright (c) 2000, 2019, 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.

--skip-grant-tables選項(xiàng)也可以在選項(xiàng)文件my.cnf中進(jìn)行設(shè)置。這個(gè)選項(xiàng)還會(huì)導(dǎo)致服務(wù)器在啟動(dòng)過程中禁止加載用戶定義函數(shù)(udf),調(diào)度事件和安裝插件語句中安裝的插件。為了以任何方式來加載插件,使用--plugin-load選項(xiàng)。--skip-grant-tables選項(xiàng)也會(huì)導(dǎo)致disabled_storage_engines系統(tǒng)變量失效。

flush privileges語句可以在服務(wù)器啟動(dòng)后通過執(zhí)行其它操作來隱式執(zhí)行。例如在升級過程中mysql_upgrade程序就會(huì)刷新權(quán)限。

感謝各位的閱讀,以上就是“分析mysqld的skip-grant-tables選項(xiàng)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對分析mysqld的skip-grant-tables選項(xiàng)這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI