Centos7环境下MYSQL数据库忘记ROOT密码处理办法

修改配置文件:vi /etc/my.cnf 添加 skip-grant-tables 保存退出

Centos7环境下MYSQL数据库忘记ROOT密码处理办法

重启mysql:service mysqld restart
免密登录:mysql -u root
进入数据库:use mysql
修改root密码:

update user set authentication_string = password('新密码'),password_last_changed=now() where user='root';

退出mysql数据库:quit
再次修改配置文件:vi /etc/my.cnf 删除 skip-grant-tables 保存退出
重启mysql服务即可

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容