Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

mysql5.7忘记root密码后如何重置root密码?

  mysql5.7忘记root密码后,无法登陆到mysql,这时就需要重置mysql root密码了。大致流程:找到mysql的配置文件,这里是my.cnf,修改关闭权限系统,重启mysql服务,重新登陆mysql,进行登陆重置密码操作。

一、关闭mysql5.7的权限系统

    找到mysql5.7的配置文件,这里是my.cnf,编辑增加代码 skip-grant-tables

vim /etc/my.cnf
#内容尾增加
skip-grant-tables

mysql5.7忘记root密码后如何重置root密码?插图

二、重启mysqld服务,登陆mysql

systemctl restart mysqld

 这时再登陆mysql时,不需要密码就登陆进去了。

mysql5.7忘记root密码后如何重置root密码?插图1

三、修改root密码

use mysql;
select host,user,authentication_string from user;
#修改root密码
update user set authentication_string = password('123456') where user = 'root';

mysql5.7忘记root密码后如何重置root密码?插图2

四、开启权限系统,重启mysql,新密码登陆

vim /etc/my.cnf
#开启权限系统
#skip-grant-tables
#重启mysql
systemctl restart mysqld
#新root密码登陆
mysql -uroot -p

mysql5.7忘记root密码后如何重置root密码?插图3

mysql5.7忘记root密码后如何重置root密码?插图4

这样就使用新密码登陆成功,mysql5.7重置root密码完成!

温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
未整理

直播带货怎么做?商家如何玩转直播带货,针对商家 内容干货 目的赚钱

2021-5-5 0:00:00

未整理

云优YUNUCMS企业网站管理系统

2021-5-7 0:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索