版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq624202120/article/details/26180801
1. 关闭mysql服务
2. 使用mysqld启动服务,使用参数—skip-grant-tables
3. 新开客户端,使用mysql命令直接进入,进入数据库mysql,找到user表
4. 重置密码
语法:update user set password = password(‘1234’) where user=’root’ and host=’localhost’;
5. 重启服务
6. 使用新的用户密码登录
注意:这种方式很不安全