Windows下请参考windows下重置mysql root密码
1.停止mysql服务
/etc/init.d/mysql stop
2.以skip-grant-tables参数启动mysql
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
3.以空密码方式登录mysql
mysql -u root
4.重置root账号密码
update mysql.user set password=PASSWORD('newpassword') where User='root';
5.刷新权限表
flush privileges;
````
6.退出mysq并重启
/etc/init.d/mysql restart