這個是因為,mysql8之前的版本使用的密碼加密規則是mysql_native_password,但是在mysql8則是caching_sha2_password,所以需要修改密碼加密規則。
1、進去mysql 8.0 command line client
2、輸入use mysql
和select user,host,plugin,authentication_string from user;
可以看到如下的界面,即用戶的密碼加密規則
3、alter user 'root' @'localhost' identified with mysql_native_password by 'admin';
本文參考網絡