一、先停掉mysql服务器,用如下命令以无密码方式重新打开mysql服务器。
mysqld --skip-grant-tables
二、用如下命令修改root的密码
mysql
mysql>use mysql
mysql>update user set authentication_string=password("NewPassword") where user="root"
mysql>quit
三、重新启动mysql服务并验证新密码
net start mysql
mysql -uroot -pNewPassword