1.可以让你的 MySQL 无密码登录
mysqld --console --skip-grant-tables --shared-memory

2.启动另外一个 cmd,启动 MySQL
mysql -u root -p密码直接按回车即可

3.清空掉密码
use mysql;
update user set authentication_string='' where user='root';(将密码置为空)

4.关闭 cmd,重新来,此时是真正的空密码登录
然后执行ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';即可。

原文地址:https://blog.csdn.net/qq_43342301/article/details/91288891


Last modification:May 19, 2022
如果觉得我的文章对你有用,请随意赞赏