錯誤訊息:Access denied for user 'root'@'localhost' (using password: YES)
my.ini(安裝目錄或 C:\ProgramData\MySQL\MySQL Server 5.x\)[mysqld] 區段加入 skip-grant-tablesnet stop/start mysql)bin 目錄,免密登入 mysql -u rootskip-grant-tables 並重啟服務# 1. 找到 my.ini
# 典型路徑:D:\MySQL\MySQL Server 5.6\my.ini
# 2. 編輯 my.ini
[mysqld]
skip-grant-tables
# 其它配置...
# 3. 重啟服務
net stop mysql
net start mysql
# 4. 免密登入
cd D:\MySQL\MySQL Server 5.6\bin
mysql -u root
# 5. 重置密碼
mysql> USE mysql;
mysql> UPDATE user SET authentication_string=PASSWORD('NewPass123!') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> QUIT;
# 6. 移除 skip-grant-tables 並重啟
# 編輯 my.ini 註釋或刪除該行
net stop mysql
net start mysql
# 7. 正常登入驗證
mysql -u root -p
--defaults-fileauthentication_string,非 passwordSET PASSWORD = PASSWORD('newpass');完成後務必移除 skip-grant-tables,否則任何本機使用者可免密登入 root。