首页 > 数据库技术 > 详细

centos7 mysql5.7 忘记密码找回

时间:2020-05-05 18:18:35      阅读:95      评论:0      收藏:0      [点我收藏+]
1、编辑mysql配置文件。

[root@localhost ~]# vi /etc/my.cnf
2、在[mysqld]配置节下新增 skip-grant-tables。

[mysqld]
skip-grant-tables
3、保存配置文件后,重启mysql服务。
[root@localhost ~]# systemctl restart mysql.service
4、使用mysql无密码命令登录mysql数据库。
[root@localhost ~]# mysql
5、使用下面语句修改root密码,注意和之前版本的mysql语句不太一样。
mysql>update mysql.user set authentication_string=password(‘新密码‘) where user=‘root‘ ;
mysql>flush privileges ;
mysql>quit
6、编辑mysql配置文件,将之前添加的skip-grant-tables去掉。
7、重启mysql服务。
[root@localhost ~]#systemctl restart mysql.service

 

centos7 mysql5.7 忘记密码找回

原文:https://www.cnblogs.com/Xingtxx/p/12831688.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!