五步重置 root 密碼,無需舊密碼:

mysqld --skip-grant-tables &
mysql -u rootUPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='root'; FLUSH PRIVILEGES;

service mysqld startmysql -u root -pnewpass
Password 列改為 authentication_string,語句調整為:UPDATE mysql.user SET authentication_string=PASSWORD('newpass') WHERE User='root';skip-grant-tables 期間**任何用戶可無密碼登錄並擁有所有權限**,務必在內網/單用戶模式下操作,完成後立即重啟。--skip-networking 禁用網絡連接:mysqld --skip-grant-tables --skip-networking &