Windows下在bin目录中
1. 关掉mysql服务
2. 输入 mysqld --console --skip-grant-tables --shared-memory
3. 重开一个cmd 以管理员身份:mysql.exe -u root
4. 将密码设为空 :UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';
5. 查询密码(密码需要为空):select host,user,authentication_string from mysql.user;
6. 重启mysql服务
7. 无密码进入:mysql.exe -u root
8. 使用 命令重设密码 ALTER user 'root'@'localhost' IDENTIFIED BY '#Mysql1234'
结束
https://blog.youkuaiyun.com/gupao123456/article/details/80766154 参考此链接

本文详细介绍在Windows环境下,如何通过一系列步骤重置MySQL数据库的root用户密码。包括关闭服务、使用特定参数启动、更新用户表、重启服务及设置新密码等关键操作。

被折叠的 条评论
为什么被折叠?



