Windows XP / XAMPP (安裝目錄 `D:/xampp`)
> net stop mysql
# 或任務管理員結束 mysqld.exe
> d:
> cd xampp/mysql/bin
> mysqld.exe --skip-grant-tables
此模式**不載入權限表**,可無密碼登入。
> mysql -u root -p
# 提示密碼直接 Enter
> USE mysql;
> UPDATE user SET Password = PASSWORD('NewStrongPass') WHERE User = 'root';
> FLUSH PRIVILEGES;
# 關閉 --skip-grant-tables 進程 (Ctrl+C 或任務管理員)
> net start mysql
> mysql -u root -pNewStrongPass
# 成功進入
UPDATE user SET authentication_string = PASSWORD('NewPass') WHERE User = 'root';
Windows 下透過 `--skip-grant-tables` 繞過權限驗證,三條 SQL 完成 root 密碼重置,全程 < 2 分鐘。記得依版本調整欄位名 (`Password`/`authentication_string`),並儘快恢復正常權限模式。