MMP,困擾5個小時的問題,終於解決。
MySQL5.7跨版本升級到MySQL8.0.21 最新版本。
通過免密鑰登陸 --skip-grant-tables
update 修改完密碼死活登陸不上。
ERROR 1045(28000) Access denied for user 'root'@'localhost' (using password YES)
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 ;