1.停掉mysql服务
ps -ef | grep mysqld
kill -9 mysql进程的pid
2.
vi /etc/my.cnf
找到[mysqld]
在下面添加一行
skip-grant-tables
保存退出
3.启动mysql服务
输入mysql直接进入Mysql
修改root的密码
update mysql.user set password=password('123456') where User='root' and Host='localhost';
刷新权限
flush privileges;
把改过的 /etc/my.cnf 改回来
重启mysql服务即可

相关文章:

  • 2021-11-10
  • 2021-05-30
  • 2021-10-21
  • 2021-09-25
  • 2021-11-17
  • 2022-02-01
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2022-01-05
  • 2021-03-27
  • 2021-08-12
  • 2022-01-30
  • 2022-12-23
  • 2022-02-10
相关资源
相似解决方案