這篇文章主要講解了“分析MySQLd的skip-grant-tables選項”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“分析mysqld的skip-grant-tables選項”吧!
超過十載行業(yè)經驗,技術領先,服務至上的經營模式,全靠網絡和口碑獲得客戶,為自己降低成本,也就是為客戶降低成本。到目前業(yè)務范圍包括了:成都網站制作、成都做網站,成都網站推廣,成都網站優(yōu)化,整體網絡托管,小程序開發(fā),微信開發(fā),成都App制作,同時也可以讓客戶的網站和網絡營銷和我們一樣獲得訂單和生意!
這個選項會導致不使用權限系統(tǒng)來啟動服務器,它將讓任何用戶可以訪問服務器并且不受限制的訪問所有數據庫。在不使用授權表啟動服務器后可以通過shell來執(zhí)行mysqladmin flush-privileges或mysqladmin reload命令或者在連接到服務器后執(zhí)行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>
現在可以執(zhí)行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>
現在可以執(zhí)行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>
現在可以執(zhí)行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系統(tǒng)變量失效。
flush privileges語句可以在服務器啟動后通過執(zhí)行其它操作來隱式執(zhí)行。例如在升級過程中mysql_upgrade程序就會刷新權限。
感謝各位的閱讀,以上就是“分析mysqld的skip-grant-tables選項”的內容了,經過本文的學習后,相信大家對分析mysqld的skip-grant-tables選項這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關知識點的文章,歡迎關注!