首先停止mysql

C:\Program Files\MySQL\bin>net stop mysql

MySQL 服务正在停止.
MySQL
服务已成功停止。

然后使用mysql bin目录的mysqld-nt.exe 执行命令 mysqld-net –skip-grant-tables

C:\Program Files\MySQL\bin>mysqld-nt.exe –skip-grant-tables

新开cmd,再次跳转到bin目录,输入mysql,即登录成功,后续就是自己修改密码之类的;

C:\Program Files\MySQL\bin>mysql

Welcome to the MySQL monitor. Commands end with ; or \g.
Your
MySQL connection id is 1
Server
version: 5.0.91-community-nt MySQL Community Edition (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>