之所以想解決并記錄這個(gè)問(wèn)題,不是因?yàn)?Navicat 中的鏈接雙擊打開(kāi)一直報(bào)錯(cuò)(內(nèi)容如標(biāo)題),而是在IDEA打算鏈接數(shù)據(jù)庫(kù)的時(shí)候,報(bào)了同樣的錯(cuò)誤。
百度,csdn每篇文章都寫(xiě)著:你密碼錯(cuò)了,盡管我分明已經(jīng)在建立之初就把密碼登記在小本本上,我對(duì)自己十分自信,但“報(bào)錯(cuò)”顯然對(duì)我沒(méi)什么自信。
按照這篇瀏覽2千卻比某些瀏覽2w+的文章內(nèi)容要好得多的文章:(101條消息) Access denied for user 'root'@'localhost' (using password:YES)解決方法_weixin_30342209的博客-CSDN博客
第1步:管理員的身份運(yùn)行cmd
第2步:
C:\WINDOWS\system32>net stop mysql
第3步:自行切換到你自己的mysql\bin
第4步:
D:\download_3\Mysql_1\mysql\bin>mysqld --defaults-file="D:\download_3\Mysql_1\mysql\my.ini" --console --skip-grant-tables
第5步:開(kāi)另外一個(gè)cmd,管理員的身份運(yùn)行
\bin>mysql -uroot mysql
打臉了,又找了一篇文章解決上面這個(gè)報(bào)錯(cuò),結(jié)果是讓我啟動(dòng)mysql,”又回到最初的起點(diǎn)~“
當(dāng)然重新找到的文章2寫(xiě)的很好,不過(guò)不是對(duì)應(yīng)我這個(gè)問(wèn)題的
又又找到一篇大佬文章,也是按上面新出現(xiàn)的問(wèn)題去找(套娃開(kāi)始!),先啟動(dòng)Mysql,然后試著登錄,輸入我記本本上的密碼,好極了————————————————
bin>mysql -u root -p
報(bào)錯(cuò)。
由于文章3是大佬作(很明顯),于是我決定重來(lái),跟著操作一遍。
前3步和上面的一模一樣,第4步,關(guān)鍵來(lái)了,大佬指出,Mysql 8.0是用不了上面的方法來(lái)跳過(guò)密碼登錄,而是輸入:
mysqld -console --skip-grant-tables --shared-memory
?
?我*,我第一次感覺(jué)我找對(duì)文章了,這文章不僅有碼,還有效果截圖,他真的,我哭死
(101條消息) ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)解決辦法_BugMiaowu2021的博客-CSDN博客_access denied for user
開(kāi)第二個(gè)cmd,管理員的身份運(yùn)行
出現(xiàn)不一致,應(yīng)該是版本不一樣的原因:?
先走了再說(shuō)
登錄,跳過(guò)密碼輸入:
下圖將界面顯示與代碼結(jié)合了:
mysql> use mysql;
//Database changed
mysql> update user set authentication_string='' where user='root';
//Query OK, 1 row affected (0.04 sec)
//Rows matched: 1 Changed: 1 Warnings: 0
//
mysql> quit
//Bye
D:\download_3\Mysql_1\mysql\bin>
D:\download_3\Mysql_1\mysql\bin>net stop mysql
/**沒(méi)有啟動(dòng) mysql 服務(wù)。
請(qǐng)鍵入 NET HELPMSG 3521 以獲得更多的幫助。**/
D:\download_3\Mysql_1\mysql\bin>net start mysql
/**mysql 服務(wù)正在啟動(dòng) .
mysql 服務(wù)已經(jīng)啟動(dòng)成功.**/
D:\download_3\Mysql_1\mysql\bin>mysql -u root -p
Enter password://回車(chē)
/**Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.**/
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
//Query OK, 0 rows affected (0.04 sec)
mysql> quit
//Bye
D:\download_3\Mysql_1\mysql\bin>mysql -u root -p
Enter password: ****//root
/**Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.29 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.**/
mysql>
省流:將Mysql密碼改為root。
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-795612.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-795612.html
到了這里,關(guān)于Access denied for user ‘root‘@‘localhost‘ (using password:YES)解決方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!