mysql5.7忘记root密码

1、编辑my.cnf文件

在mysqld配置中增加行skip-grant-tables,去掉密码验证登录数据库

重启mysql

2、登录到mysql后输入命令update mysql.user set authentication_string = password('123456') where user='root';

3、刷新权限flush privileges;

4、编辑配置文件增加密码验证,重启mysql

猜你喜欢

转载自www.cnblogs.com/tiantianhappy/p/11634816.html