1. 找到配置文件my-default.ini ,然后将其打开,可以选择用记事本打开
2. 打开后,搜索mysqld关键字
3. 保存后重启mySQL
4. 然后运行cmd
5. 设置root密码:
修改密码:
update mysql.user set authentication_string=password('root') where user='root';
alter user'root'@'localhost' identified by 'root';
将密码过期修改为密码不过期:
UPDATE user SET `password_expired`='N' where user='root';
更新操作:
flush privileges;
6. 重启服务;
7. 修改密码成功。