美文网首页
mysql恢复root密码

mysql恢复root密码

作者: 后端老鸟 | 来源:发表于2017-12-08 00:36 被阅读0次

【转载请注明出处】:https://www.jianshu.com/p/8a6f32e37a87

用命令编辑/etc/my.cnf配置文件
在[mysqld]下添加skip-grant-tables,然后保存并退出,然后重启

service mysqld restart

连接mysql服务

mysql
update mysql.user set authentication_string=password('123qwe') where user='root' ;
flush privileges;
quit;

如果密码正确,但是access denied


image.png

grant all privileges on . to 'root'@'localhost' identified by '123qwe';

用命令编辑/etc/my.cnf配置文件,去掉skip-grant-tables
重启mysql服务

service mysqld restart

【转载请注明出处】:https://www.jianshu.com/p/8a6f32e37a87

相关文章

网友评论

      本文标题:mysql恢复root密码

      本文链接:https://www.haomeiwen.com/subject/jsssixtx.html