错误原因:项目版本的MySQL与当前环境的mysql版本不符,在mysql8.0以前使用的密码加密规则是mysql_native_password ,但是在8.0之后变为了caching_sha2_password, 解决错误的方法就是将mysql环境的加密方式修改回去mysql_native_password 。
1、进入mysql
2、输入use mysql
3、输入select user,host,plugin,authentication_string from user;
4、输入alter user 'root' @'localhost' identified with mysql_native_password by 'admin';即可将加密方式修改为mysql_native_password