异常Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The ser

这是我刚刚步入Mybatis第一个入门程序出现的错误:

在这里插入图片描述
错误的全名:
Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ’ й ׼ʱ ’ 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.

解决方案:
首先检查我们的配置文件链接数据库的url是否错误:
8.0以下的正确写法是:com.mysql.jdbc.Driver
8.0以上的正确写法是:com.mysql.cj.jdbc.Driver
如果这样不行在后面加上:
?serverTimezone=UTC 或者 ?serverTimezone=GMT
这两句的任意一句试试。
在这里插入图片描述
然后就查询出来了
在这里插入图片描述

发布了33 篇原创文章 · 获赞 35 · 访问量 1594

猜你喜欢

转载自blog.csdn.net/weixin_45216092/article/details/103540671