您的位置:首页 > 运维架构 > Linux

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

2016-01-21 09:50 507 查看
上篇博文介绍了关于MySQL中的root密码忘记的情况下如何找回,可是楼主遇到更无语的是使用―skip-grant-tables选项来启动MySQL服务后,准备修改密码时却发现User表为空,


update user set Password=password('newpassword') where User='root’;
输入修改密码后得到
0 rows affected rows
matched :0 changed:0
真是蛋疼无比,那还改个毛毛啊!!!




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

grant all on *.* to root@'localhost' identified by 'password';
grant all on *.* to root@'%' identified by 'password';
但是然并卵啊,使用―skip-grant-tables登录之后,创建用户提示错误啊,提示在―skip-grant-tables无法创建用户。
楼主彻底崩溃!!!






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表发现里面已经有数据了,哈哈,搞定,继续修改密码,重启生效

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: