1. 程式人生 > >安裝mysql後連接出錯(錯誤:Access denied for user 'root'@'localhost' (using password: YES)")的解決辦法

安裝mysql後連接出錯(錯誤:Access denied for user 'root'@'localhost' (using password: YES)")的解決辦法

access 設置 lec 提示 回車 eight png varchar oot

  前幾天下載了mysql5.7正常安裝後,用navicat for mysql連接時提示“Access denied for user [email protected] (using password: YES)"”錯誤信息,因為第一次安裝時未添加用戶,所以卸載一次又重新添加了用戶和密碼安裝後打開依然報錯,借鑒了網上的一些方法,然後用自己的方法實現了連接。

解決方法:

1、打開mysql Command Line Client,輸入安裝mysql時設置的密碼,出現如下界面;

技術分享

2、輸入 "use mysql;"後回車,用於應用mysql,出現如下界面;

技術分享

3、輸入 "select user,host from user;"後回車,用於查詢數據庫的用戶信息。出現如下界面;

技術分享

4、輸入“select user,host,password from user;”後回車,用於查詢用戶是否設置了密碼,若能查出則跳至步驟6,若查不出則繼續往下執行(本人當時就查不出所以先添加了password列,再執行修改密碼);

技術分享

5、輸入“alter table user add column password varchar(64);”後回車,用於添加password列。

6、輸入“update user set password=password(‘123‘);”後回車,用於修改密碼為123,出現如下界面;

技術分享

至此問題得以解決。

安裝mysql後連接出錯(錯誤:Access denied for user 'root'@'localhost' (using password: YES)")的解決辦法