mysql8 忘记密码解决办法

开一个终端

# 关闭mysql服务
net stop mysql
## 运行
mysqld --console --skip-grant-tables --user=mysql --shared-memory

再开一个终端 管理员模式

mysql -u root -p # 直接按Enter即可
use mysql;
update user set authentication_string='' where user='root'; # 将root的验证设置为空
flush privileges; #刷新使上述命令操作生效
alter user 'root'@'localhost' identified by '654321'; #将root密码修改为654321;
quit
net start mysql # 已经成功了

作者:spike

分类: Mysql

创作时间:2024-01-31

更新时间:2024-01-31

联系方式放在中括号之中例如[[email protected]],回复评论在开头加上标号例如:#1
Copyright © Your Website 2024
介绍 赞助 Github Rss Sitemap 免责声明 联系