centos7——mysql5.7忘記root密碼的處理方式


參考資料:https://www.cnblogs.com/nangch/p/5521193.html

解決方法:

一、通過編輯/etc/my.cnf文件在[mysqld]下面加上skip-grant-tables=1,保存退出;

二、重啟MySql服務【systemctl restart mysqld.service】;

三、以root身份登錄MySql【mysql -u root】;

四、進入mysql數據庫【mysql>   use mysql;】;

五、修改root密碼:

mysql> update user set authentication_string = password('新密碼'),password_last_changed=now() where user='root';

六、退出mysql,再次編輯/etc/my.cnf文件,將第一步中添加的skip-grant-tables=1刪掉,重啟啟動MySql服務即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM