MySQL忘记密码

 
 
  • 第一步:打开mysql5.7的配置文件my.cnf,并在里面增加一行:skip-grant-tables   保存并退出(:wq)
[root@iz09a32x1sghz3z ~]# vi /etc/my.cnf
 
用root账号登录: [root@iz09a32x1sghz3z ~]# mysql -u root
使用mysql中的mysql数据库: mysql> use mysql;
修改密码:  update user set authentication_string = password("Szfore_68638") where user="root" ;
刷新数据库: flush privileges;
退出: quit;
原文地址:https://www.cnblogs.com/QuestionsZhang/p/11709115.html