windows下mysql忘记root密码的解决方法

1、停止正在运行的MySQL服务,在DOS窗口下输入net stop mysql5 或 net stop mysql

2、开一个DOS窗口,这个需要切换到mysql的bin目录。 进去到MySQL的安全模式,输入 mysqld-nt --skip-grant-tables;

3、再开一个DOS窗口,mysql -u root

4、输入: 

use mysql update user set password=password("123456") where user="root";

flush privileges;

exit;

5、使用任务管理器,找到mysqld-nt的进程,结束进程

6、重新启动MySQL,即可用root的新密码登录