MySQL8.0.21 root 密碼登陸不入-ERROR 1045(28000) Access denied for user 'root'@'localhost' (using password YES)


MMP,困擾5個小時的問題,終於解決。

MySQL5.7跨版本升級到MySQL8.0.21 最新版本。

通過免密鑰登陸 --skip-grant-tables  

update 修改完密碼死活登陸不上。

ERROR 1045(28000) Access  denied for user 'root'@'localhost' (using password YES)

https://blog.csdn.net/lei95/article/details/104736176?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase

1)./mysqld_safe  --defaults-file=/etc/my821.cnf       -skip-grant-tables   &

2) ./mysql 

槽,將root密碼清空成空格!!!!!!!!

mysql>update  mysql.user  set  authentication_string=''  where user='root ';

3) flush privileges

4) 正常啟動

/mysqld_safe  --defaults-file=/etc/my821.cnf  &

5)空密碼登陸

./mysql  -uroot  -p空格

6) 在正常登陸情況下 ,alter user  ‘root'@'localhost' identified  with  mysql_native_password by 'MyQ_123' ;  flush  privileges  ;

7)再次登陸,  ./mysql -uroot  -pMyQ_123

 

原因是 :在MySQL 8.0中,caching_sha2_password是默認的身份驗證插件,而不是mysql_native_password 。 

select  host ,user  , authentication_string,plugin from mysql.user  where user='root'  \G ;

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM