mysql8.0以上要无密码登录输入
mysqld --console --skip-grant-tables --shared-memory
然后重新开启一个新的cmd
mysql 直接进入
修改密码用
alter user’root’@‘localhost’ identified by ‘新密码’;
先刷新一下权限表。
mysql> flush privileges;
再
alter user’root’@‘localhost’ identified by ‘新密码’;
然后重启服务 输入新密码即可