1、在管理员进入cmd,进入mysql安装目录下的bin
并输入net stop mysql
后输入mysqld --console --skip-grant-tables --shared-memory
2、打开cmd的另一个界面
输入mysql后再输入use mysql
3、重设密码
update mysql.user set authentication_string=password('anywhere') where user='root' ;
4、在任务管理器找到“服务”,启动其中的MYSQL服务
5、输入mysql -u root -p和密码便可以使用