项目启动报错‘java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.’;

原因:本地数据库服务器升级到8.0,项目中引用的jar包还是5.0的所以报错

解决:更换mysql-connection-java的jar包,匹配到对应的高版本

jar包更换后发现,项目依旧报错:

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException:The server time zone value ‘?D1ú±ê×?ê±??’ is unrecognized or represents more than one time zone.You must configure either the server or JDBC driver (via the serverTimezone configuration property)to use a more specifc time zone value if you want to utilize time zone support.

解决:此问题为时区问题,在 JDBC 的连接 url 部分加上 serverTimezone=UTC,如下图
在这里插入图片描述

欧了,项目成功启动!

猜你喜欢

转载自blog.csdn.net/weixin_44465068/article/details/86152882