mysql恢复root密码

2017-12-08  本文已影响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

上一篇 下一篇

猜你喜欢

热点阅读