解决MySQL连接时异常InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unreco

详细报错信息

java.sql.SQLException: 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.


版本描述

MySQL  5.7.17

mysql-connector-java.jar    8.0.15


此异常出现的原因为:如果mysql-connector-java用的6.0以上的,需要指定时区serverTimezone,如下图

备注


当mysql-connector-java.jar使用6.0或以上版本,须将Driver由com.mysql.jdbc.Driver更改为com.mysql.cj.jdbc.Driver否则项目启动时控制台会输出警告如下:

解决MySQL连接时异常InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unreco_第1张图片

 

 

 

你可能感兴趣的:(数据库)