某一天發現mysql登錄失敗了,登錄的時候報下面的錯誤
在MySQL登錄時出現Access denied for user 'root'@'localhost' (using password: YES) 拒絕訪問.
一般出現這樣的錯誤都是因為密碼錯了。如果原來的密碼不記得了,這時候只能重新設置下密碼。
解決方法:
1、到mysql的安裝目錄下找到my.ini, 在[mysqld]后添加skip-grant-tables(使用 set password for設置密碼無效,且此后登錄無需鍵入密碼)。

2、 然后重啟mysql服務, net stop mysql;net start mysql;
3、登錄mysql,鍵入mysql –uroot –p;直接回車(Enter)
4、修改密碼: alter user root@'localhost' identified by 'test1234';
5、退出mysql;把上面添加到my.ini的skip-grant-tables刪除,
6、最后重啟mysql服務 net stop mysql;net start mysql;
