转载连接:http://jianfw2009.blog.163.com/blog/static/13431366020111016112459158/
1、先停止mysql服务
2、在mysql的目录下找到my.ini,在[mysqld]后面加上skip-grant-tables
3、启动mysql服务,打开Command Line Client以空密码登录
4、退出mysql,并停止服务
5、把my.ini中添加的:skip-grant-tables 去掉
5、再次开启mysql服务,直接回车登录,输入:set password for root@localhost=password('newpwd');
6、退出重新配置,大功告成!