mysql 忘记密码解决方案
mysql 忘记密码
一、通过编辑/etc/my.cnf文件在[mysqld]下面加上skip-grant-tables=1,保存退出;
二、重启MySql服务【systemctl restart mysqld.service】;
三、以root身份登录MySql【mysql -u root】;
四、进入mysql数据库【mysql> use mysql;】;
五、修改root密码:
mysql> update user set authentication_string = password('newpassword1111!!!'),password_last_changed=now() where user='root';
六、退出mysql,再次编辑/etc/my.cnf文件,将第一步中添加的skip-grant-tables=1删掉,重启启动MySql服务即可。
博文最后更新时间:
评论
-
暂无评论