1,跳過數據庫權限驗證mysql
mysqld --skip-grant-tables --user=mysql &
2,sql
systemctl restart mysqld
正常狀況是起不來 的等個大概10秒ctrl + c終止數據庫
3,輸入mysql 便可進入ide
4,修改新密碼this
UPDATE mysql.user SET authentication_string=password('new_password') WHERE user='root' AND host='localhost';
5,刷新受權表rest
FLUSH PRIVILEGES; 刷新受權表
6,exit 退出數據庫從新用新密碼登陸,便可登陸成功
7,最好reboot重啓一下,使mysql變爲運行狀態code
注意:報錯處理ip
問題1:ERROR You must reset your password using ALTER USER statement before executing this statementstring
解決方案:ALTER USER 'root'@'localhost' IDENTIFIED BY 'xinmima';it