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程式就會重新整理許可權。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2667416/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysqld_safe和mysqldMySql
- mysqld和mysqld_safeMySql
- mysqld與mysqld_safeMySql
- the --skip-grant-tables option so it cannot
- mysqld --verboseMySql
- mysqld got signal 8MySqlGo
- Mysqld_safe支援選項MySql
- mysqld: Sort aborted: Server shutdown in progressMySqlServer
- mysql 5.0.41 mysqld 引數大全MySql
- [mysqld_safe] 中的引數使用mysqld_safe命令啟動時不生效?MySql
- mysqld_multi 無法停庫MySql
- mysqld_multi 命令使用報錯MySql
- 不重啟mysqld更改root密碼MySql密碼
- nysql 5.0.22 mysqld 引數大全MySql
- ERROR 2002 (HY000): Can't connect server socket /var/run/mysqld/mysqld.sockErrorServerMySql
- 使用skip-grant-tables啟動庫後不能執行grant語句
- mysqld_safe之三言兩語MySql
- MySQL入門--Mysqld_multi多例項MySql
- Mysqld接受許多命令列選項MySql命令列
- (slave不停restart)mysqld got signal 11RESTMySqlGo
- 【MySQL】mysql啟動常見報錯 mysqld_safe mysqld from pid file hostname.pid endedMySql
- mysql服務啟動報錯Redirecting to systemctl start mysqld.serviceFailed to start mysqld.service:Unit not found.MySqlAI
- 怎麼樣把mysqld壓測到崩潰重啟?什麼情況下mysqld崩潰重啟?MySql
- mysqld或mysqld_safe啟動時必須放在第一位的引數(first argument)MySql
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables optErrorMySqlServer
- mysql關於mysqld_safe的總結MySql
- pprof 分析mysqld 記憶體呼叫(筆記)MySql記憶體筆記
- 利用mysqld_multi配置單機多例項MySql
- 利用pgrep批量kill殺死多個mysqld程式MySql
- 【MySQL】mysqld got signal 11 案例一則MySqlGo
- mysqld: Table '.mac_vod' is marked as crashed and should be repairedMySqlMacAI
- mysqld_multi安裝多個mysql例項MySql
- mysql使用mysqld_multi工具啟動多例項MySql
- mysqld_multi啟動多個mysql例項MySql
- mysql配置檔案中mysqld_safe介紹MySql
- 執行SQL語句導致mysqld的crashMySql
- 影響mysqld安全的幾個選項(轉)MySql
- 在linux中無法啟動mysqld 服務LinuxMySql