在MySQL安装后 出现“Access denied for user ‘root’@‘localhost’ (using password: YES)”错误
这时候就需要重置密码,重置密码步骤为:
1.找到安装目录D:\MySQL\MySQL Server 5.5下的my.ini文件,并用记事本打开
2.在my.ini文件最后面添加 skip-grant-tables 这个字符串
3.重启mysql服务,这时的mysql不需要密码即可登录数据库
然后进入mysql
mysql>use mysql;
mysql>更新 update user set password=password(‘新密码’) WHERE User=‘root’;
mysql>flush privileges;
运行之后最后去掉my.ini中的skip-grant-tables,重启mysqld即可。