mysql8.0及以上版本修改密码的问题

mysql8.0以上要无密码登录输入

mysqld --console --skip-grant-tables --shared-memory

然后重新开启一个新的cmd

mysql 直接进入

修改密码用
alter user’root’@‘localhost’ identified by ‘新密码’;

如果出错mysql错误:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement解决方法

先刷新一下权限表。

mysql> flush privileges;


alter user’root’@‘localhost’ identified by ‘新密码’;

然后重启服务 输入新密码即可

你可能感兴趣的:(mysql8.0及以上版本修改密码的问题)