1.停掉mysql服务
2.打开一个命令行窗口用如下命令启动mysql
mysqld --skip-grant-tables
3.修改root密码
另外打开一个命令行窗口执行下面命令
mysql
mysql> use mysql
mysql> update user set password=password('new_password') where user='root';
mysql> commit;
4.关闭所有的mysql进程,然后重启mysql
1.停掉mysql服务
2.打开一个命令行窗口用如下命令启动mysql
mysqld --skip-grant-tables
另外打开一个命令行窗口执行下面命令
mysql
mysql> use mysql
mysql> update user set password=password('new_password') where user='root';
mysql> commit;