windows 重置密码
1、修改my.ini
增加 skip-grant-tables
2、停止 net stop mysql
3、启动 net start mysql
4、登录 mysql -u root -p
5、更新sql
use mysql;
update user set authentication_string = password(“@Zhaodeman199814”) where user = “root”;
6、设置直接生效
flush privileges;
linux 重置密码
1、修改的/etc/my.cnf
增加 skip-grant-tables
2、停止 net stop mysql
3、启动 net start mysql
4、登录 mysql -u root -p
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vpmMqIGt-1656422055979)(C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20220628201259002.png)]
5、更新sql
use mysql;
update user set authentication_string = password(“@Zhaodeman199814”) where user = “root”;
6、设置直接生效
flush privileges;