- 關(guān)閉MySQL數(shù)據(jù)庫
service mysqld stop
- 編輯my.cnf文件
[mysqld]
skip-grant-tables
- 免密登陸
mysql -uroot -p
回車
- 刷新系統(tǒng)權(quán)限相關(guān)表
mysql> flush PRIVILEGES;
- 重新設(shè)置密碼
mysql> alter user 'root'@'localhost' identified by 'Abc@12345678';
flush tables;
- 去掉my.cnf文件中的skip-grant-tables配置朽寞,重啟mysql的服務(wù)并登錄炒瘟。