一、破解思路:
- 此種方法適合破解線下數(shù)據(jù)庫(kù)服務(wù)器管理員root密碼
- 修改主配置文件重啟服務(wù)
- 無(wú)密碼登錄后,執(zhí)行修改密碼指令
- 還原配置文件重啟服務(wù)
二、實(shí)操:
第一步:修改主配置文件,并重啟服務(wù)
[root@host50 ~]# vim /etc/my.cnf
[mysqld]
# 在這行下方添加
# 實(shí)現(xiàn)連接服務(wù)不需要輸入用戶名和密碼
skip-grant-tables
# 保存退出
:wq
[root@host50 ~]# systemctl restart mysqld
第二步:登錄數(shù)據(jù)庫(kù),修改密碼
# 無(wú)密碼登錄
[root@host50 ~]# mysql
# 修改管理員root 本機(jī)登陸密碼為666…QQQa
mysql> update mysql.user set authentication_string=password("666…QQQa")
where user="root" and host="localhost";
# 刷新,確保修改生效
mysql> flush privileges;
- 查看數(shù)據(jù)庫(kù)管理員root本機(jī)登錄密碼
- 密碼是加密后保存的
# 查詢mysql.user表的數(shù)據(jù)是否更新
mysql> select host,user,authentication_string from mysql.user
where user="root" and host="localhost";
# 確認(rèn)沒(méi)問(wèn)題后,斷開(kāi)連接
mysql> exit;
第三步:還原配置文件重啟服務(wù)
[root@host50 ~]# vim /etc/my.cnf
[mysqld]
#skip-grant-tables
:wq
[root@host50 ~]# systemctl restart mysqld
[root@host50 ~]# mysql -uroot -p666…QQQa
mysql>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。