当前位置:Gxlcms > 数据库问题 > mysql忘记root密码

mysql忘记root密码

时间:2021-07-01 10:21:17 帮助过:2人阅读

MySQL启动参数中有个是 --skip-grant-tables,叫做跳过授权表

1、停止mysqld服务

2、vim /etc/my.cnf

  [mysqld]

  skip-grant-tables

3、重启mysql

4、进入mysql命令行

  mysql>use mysql

  mysql>update user set password=password(‘newpassword‘) where user=‘root‘;

  mysql>flush privileges;

  mysql>exit

5、去掉刚在my.cnf中增加的一行

  #skip-grant-tables


mysql忘记root密码

标签:mysql

人气教程排行