killall -TERM mysqld 或 systemctl stop mysqld/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &/usr/sbin/mysqld)/usr/local/mysql/bin/mysql -u root -pUSE mysql;
UPDATE user SET authentication_string=PASSWORD('NewPass123!') WHERE User='root';
FLUSH PRIVILEGES;authentication_string,5.6 為 password)killall mysqld
systemctl start mysqldmysql -u root -p'NewPass123!' -e "SELECT VERSION()"net stop mysql 或工作管理員結束 mysqld.exe。X:\MySQL\bin\mysqld-nt.exe --skip-grant-tablesX:\MySQL\bin\mysql -u root -p(直接 Enter)--skip-grant-tables 進程,net start mysql。--skip-grant-tables 期間**任何人可免密以 root 登入**,務必在內網/防火牆保護下操作,完成即關閉。ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPass123!';