MySQL重置root密码

vim /etc/my.cnf

在mysqld下添加 skip-grant-tables

重启服务

如果是mysql5.7以后的版本:

update user set authentication_string='root' where user='root';

如果是mysql5.7以前的版本

update user set password=password('root') where user='root';

退出

vim /etc/my.cnf

去掉 skip-grant-tables

重启服务,登录即可

posted @ 2018-12-27 18:38  光何  阅读(131)  评论(0编辑  收藏  举报