1.以管理员身份打开cmd,切换到MySQL的bin目录
2.关闭MySQL服务器
net stop mysql
3.跳过输入密码的步骤mysqld --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables
(注意:文件名字与路径要与自己的吻合)
4.重启服务器
net start mysql
5.登录MySQL服务器
mysql -u root -p
输入密码之后就能登录成功了
Access denied for user 'root'@'localhost' (using password: YES)
原文:https://www.cnblogs.com/xxsl/p/10790597.html