您好,登錄后才能下訂單哦!
這篇文章主要講解了“分析mysqld的skip-grant-tables選項”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“分析mysqld的skip-grant-tables選項”吧!
這個選項會導致不使用權限系統來啟動服務器,它將讓任何用戶可以訪問服務器并且不受限制的訪問所有數據庫。在不使用授權表啟動服務器后可以通過shell來執行mysqladmin flush-privileges或mysqladmin reload命令或者在連接到服務器后執行flush privileges語句來讓正在運行的服務器再次使用授權表。
使用--skip-grant-tables選項啟動服務器
[root@localhost mysql]# service mysqld stop Shutting down MySQL. SUCCESS! [root@localhost mysql]# service mysqld start --skip-grant-tables Starting MySQL.. SUCCESS!
現在就可以不使用用戶和密碼就可以登錄服務器
[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>
現在可以執行mysqladin flush-privileges命令讓正在運行的服務器再次使用授權表
[mysql@localhost ~]$ mysqladmin flush-privileges
現在不使用用戶和密碼就不能登錄服務器了,必須使用用戶和密碼才能登錄了
[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選項啟動服務器
[root@localhost mysql]# service mysqld stop Shutting down MySQL.. SUCCESS! [root@localhost mysql]# service mysqld start --skip-grant-tables Starting MySQL.. SUCCESS!
現在就可以不使用用戶和密碼就可以登錄服務器
[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>
現在可以執行mysqladin reload命令讓正在運行的服務器再次使用授權表
mysql@localhost ~]$ mysqladmin reload
現在不使用用戶和密碼就不能登錄服務器了,必須使用用戶和密碼才能登錄了
[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選項啟動服務器
[root@localhost mysql]# service mysqld stop Shutting down MySQL. SUCCESS! [root@localhost mysql]# service mysqld start --skip-grant-tables Starting MySQL.. SUCCESS!
現在就可以不使用用戶和密碼就可以登錄服務器
[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>
現在可以執行flush privileges語句讓正在運行的服務器再次使用授權表
mysql> flush privileges; Query OK, 0 rows affected (0.12 sec)
現在不使用用戶和密碼就不能登錄服務器了,必須使用用戶和密碼才能登錄了
[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選項也可以在選項文件my.cnf中進行設置。這個選項還會導致服務器在啟動過程中禁止加載用戶定義函數(udf),調度事件和安裝插件語句中安裝的插件。為了以任何方式來加載插件,使用--plugin-load選項。--skip-grant-tables選項也會導致disabled_storage_engines系統變量失效。
flush privileges語句可以在服務器啟動后通過執行其它操作來隱式執行。例如在升級過程中mysql_upgrade程序就會刷新權限。
感謝各位的閱讀,以上就是“分析mysqld的skip-grant-tables選項”的內容了,經過本文的學習后,相信大家對分析mysqld的skip-grant-tables選項這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。