当前位置:首页 > 操作系统 > Linux

Linux---MySQL密码找回方式高级版

上篇博文介绍了关于MySQL中的root密码忘记的情况下如何找回,可是楼主遇到更无语的是使用—skip-grant-tables选项来启动MySQL服务后,准备修改密码时却发现User表为空,技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />

update user set Password=password(‘newpassword‘) where User=‘root’;

输入修改密码后得到

0 rows affected rows 
matched :0 changed:0

真是蛋疼无比,那还改个毛毛啊!!!技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />

有网友说创建root并赋予权限

grant all on *.* to root@‘localhost‘ identified by ‘password‘;
grant all on *.* to root@‘%‘ identified by ‘password‘;

但是然并卵啊,使用—skip-grant-tables登录之后,创建用户提示错误啊,提示在—skip-grant-tables无法创建用户。

楼主彻底崩溃!!!技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012232681.jpg" />

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement


后来试了下flush privileges 一下,

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)


ok,再执行添加root用户就可以了,查询User表发现里面已经有数据了,哈哈,搞定,继续修改密码,重启生效技术分享650) this.width=650;" src="/upload/getfiles/default/2022/11/12/20221112012233167.jpg" />

原文:http://ezioauditor.blog.51cto.com/8742351/1737003


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!