如何破解MySQL5.7數(shù)據(jù)庫的root登錄密碼-創(chuàng)新互聯(lián)

這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān)如何破解MySQL5.7 數(shù)據(jù)庫的root登錄密碼,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

創(chuàng)新互聯(lián)建站2013年開創(chuàng)至今,先為雞冠等服務(wù)建站,雞冠等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為雞冠企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
導(dǎo)讀本文檔詳細介紹破解 MySQL5.7 數(shù)據(jù)庫的 root 登錄密碼

忘記 root 登錄密碼

[root@MySQL1 ~]# mysql -uroot -p1231234
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

在 /etc/my.cnf 配置文件中添加 skip-grant-tables 繞開 MySQL5.7 數(shù)據(jù)庫密碼驗證

[root@MySQL1 ~]# echo skip-grant-tables >> /etc/my.cnf
[root@MySQL1 ~]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS! 
Starting MySQL. SUCCESS!

直接使用 mysql  命令登錄 MySQL5.7 數(shù)據(jù)庫并修改 root 登錄密碼

[root@MySQL1 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19-log Source distribution
Copyright (c) 2000, 2017, 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> ALTER  USER   'root'@'localhost'   IDENTIFIED BY  'password';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER  USER   'root'@'localhost'   IDENTIFIED BY  'password';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye

注意:如果在執(zhí)行該步驟的時候出現(xiàn) ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement 錯誤。則執(zhí)行下 flush privileges;  命令,再執(zhí)行該命令即可。

使用新密碼 password 登錄 MySQL5.7 數(shù)據(jù)庫

[root@MySQL1 ~]# mysql -uroot -ppassword
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19-log Source distribution
Copyright (c) 2000, 2017, 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> exit
Bye

使用其他密碼不能登錄 MySQL5.7 數(shù)據(jù)庫

[root@MySQL1 ~]# mysql -uroot -ppasswordd
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

優(yōu)化

刪掉 /etc/my.cnf 里的 skip-grant-tables

[root@MySQL1 ~]# sed -i -e '/skip-grant-tables/d' /etc/my.cnf

重啟數(shù)據(jù)庫

[root@MySQL1 ~]# /etc/init.d/mysqld restart

上述就是小編為大家分享的如何破解MySQL5.7 數(shù)據(jù)庫的root登錄密碼了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。

分享題目:如何破解MySQL5.7數(shù)據(jù)庫的root登錄密碼-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://bm7419.com/article14/cdgpge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、品牌網(wǎng)站建設(shè)移動網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計Google、電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)