大漠知秋的加油站

  • 首页
大漠知秋的加油站
你就当我的烂笔头吧
  1. 首页
  2. MySQL
  3. 正文

MySQL 5.7.x root 忘记密码

2019年5月17日 818点热度 0人点赞 0条评论
  • 首先停掉 MySQL 服务
$ systemctl stop mysqld
  • 在 MySQL 配置文件中增加 skip-grant-tables 配置
$ vim /etc/my.cnf
......
[mysqld]
skip-grant-tables
......
  • 重启 MySQL
$ systemctl restart mysqld
  • 登录 MySQL 修改密码

  这次登录无需密码

$ mysql -uroot

# MySQL 5.6
mysql> update mysql.user set authentication_string=password('123456') where and user='root';
# MySQL 5.7
mysql> update mysql.user set password=password('123456') where and user='root';

# 刷新
mysql> flush privileges;
  • OK,用新密码重试
标签: root 重置密码
最后更新:2019年5月17日

大漠知秋

唯黄昏而思烛明,唯覆雪始念日暖,唯放手方知情真,今困苦而怀峥嵘,今飘零而涌乡愁,今孑然而徒唏嘘,唏嘘成愁。

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2023 大漠知秋的加油站. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备16029200号-2