参考资料:https://www.cnblogs.com/nangch/p/5521193.html

解决方法:

一、通过编辑/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('新密码'),password_last_changed=now() where user='root';

六、退出mysql,再次编辑/etc/my.cnf文件,将第一步中添加的skip-grant-tables=1删掉,重启启动MySql服务即可。

相关文章:

  • 2022-12-23
  • 2021-04-01
  • 2021-05-22
  • 2021-12-16
  • 2021-11-12
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2021-12-14
  • 2021-11-14
  • 2021-12-04
相关资源
相似解决方案