一個非常有用的mysql啟動參數(shù):--skip-grant-tables, 顧名思義,就是在啟動mysql時不啟動 grant-tables(授權表)。有什么用呢?當然是忘記管理員密碼時用到。
步驟:
步驟1. 停止原來進行著的mysql
$ service mysqld stop
注意,如果是Ubuntu系統(tǒng),這樣:
$ sudo service mysql stop
步驟2. 以命令行參數(shù)啟動mysql
$ /usr/bin/mysqld_safe --skip-grant-tables &
步驟3. 用root登錄mysql
一路回車不用輸入密碼就可以進入mysql shell啦!
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.6.28-0ubuntu0.15.04.1 (Ubuntu) Copyright (c) 2000, 2015, 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>
這時就可以隨便操作數(shù)據(jù)庫啦!
聲明:本網(wǎng)頁內容旨在傳播知識,若有侵權等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com