您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页linux部署的数据库忘记root密码

linux部署的数据库忘记root密码

来源:华佗小知识

1、编辑配置文件

vim etc/my.cnf

内容:在[mysqld] 节点下加入 skip-grant-tables

结束:(1)Esc (2):wq

2、重启mysql服务

service mysqld restart

3、进入mysql 并进行修改密码

mysql -u root

use mysql   #进入数据库

#修改
update mysql.user set authentication_string = password('你的新密码') where user='root';

4、退出mysql并恢复配置文件

(1)退出mysql :ctrl+z

(2)打开配置文件

vim etc/my.cnf

 删除在[mysqld] 节点下添加的 skip-grant-tables

结束:(1)Esc (2):wq

5、重启mysql

service mysqld restart

好了,就是这么简单,磨了我 30分钟,擦,如有帮助,帮忙点个赞吧,感谢

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务