Mysql_新建連接報錯:Client does not support authentication protocol requested by server ;consider upgrading Mysql client
原因:
上網搜索解決方案,網上說出現這種情況的原因是:mysql8 之前的版本中加密規則是mysql_native_password,而在mysql8之后,加密規則是caching_sha2_password,
解決方法:
1、進入Mysql服務端:
輸入mysql -u root -p,輸入密碼進入
2、繼續輸入:
ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密規則 (這行我沒有寫,不過貌似也可以)
ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY '你自己的密碼'; #更新一下用戶的密碼
FLUSH PRIVILEGES; #刷新權限