首页 > 数据库技术 > 详细

centos mysql忘记密码

时间:2016-03-26 13:49:05      阅读:251      评论:0      收藏:0      [点我收藏+]

1.停止mysql 服务:service mysqld stop;

2.vim命令打开mysql配置文件my.cnf(位置一般为:/etc/my.cnf)

3.在mysqld进程配置文件中添加skip-grant-tables,添加完成后保存。

4.重新打开mysql服务:service mysqld stop;

5.登陆mysql:mysql -u root -p; 不用输入密码登录mysql;

6.update user  set password=password(‘newpassword‘) where user=‘root‘ (5.7以前版本)

  update user  set authentication_string=password(‘newpassword‘) where user=‘root‘ (5.7及以后版本)

 

7.在mysqld进程配置文件中注释skip-grant-tables,添加完成后保存

 

8.重启mysql服务

centos mysql忘记密码

原文:http://www.cnblogs.com/zhangchengxiang/p/5322646.html

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