SQLException: The server time zone value '�й���׼ʱ��' is unrecognized

原创 2017年07月20日 17:40:59

在使用spring boot操作数据库的时候,莫名其妙抛了一个错误:

ERROR o.a.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.

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连接的依赖包是高版本的情况下:

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>6.0.6</version>
</dependency>

在配置datasource.url时不能简单的这样配:

spring.datasource.url=jdbc:mysql://localhost:3306/chat

需要加上一些必要的后缀信息(改成下面的配置就可以了):

spring.datasource.url=jdbc:mysql://localhost:3306/chat?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
版权声明:本文为博主原创文章,未经博主允许不得转载。

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You m

在Mybatis连接数据库配置文件的时候报时区异常The server time zone value '�й���׼ʱ��' is unrecognized or represents more t...

bug: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.

在 mysql 中执行命令试下: set global time_zone=’+8:00’ 设置为东8区就不报错了。...

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.

在通过在数据库连接URL后,加上?serverTimezone=UTC

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You mu

服务器的时区价值”�й���׼ʱ��的识别或代表多个时区。您必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)使用一个更具体的时区值如果你想利用时区支持。 在通过在...

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You mu

spring+springMVC+mybatis+mysql启动时,总报错The server time zone value '�й���׼ʱ��' is unrecognized or repre...

SSM时jdbc报错 Cannot create PoolableConnectionFactory (The server time zone value '�й���׼ʱ��' is unreco

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb...

使用连接mysql的jdbc驱动最新版引发的问题

转载自http://www.th7.cn/Program/java/201607/907115.shtml 使用最新的连接驱动mysql mysql-connector-java 6.0.3运行...

解决mysql java.sql.SQLException: The server time zone value‘XXXXXX' is unrecognized or represents...

个人错误总结解决java.sql.SQLException: The server time zone value ‘XXXXXX’ is unrecognized or represents mor...

异常:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more

软件开发,为了满足开发的需要,jar包版本的更新或bug的修复,会造成 版本不兼容,出现新问题,程序员就是为解决问题出现的,一句话就是我们爱折腾,乐此不彼。 异常错误:java.sql.SQLExce...

IntelliJ idea 中Live Template

转载自:http://blog.csdn.net/kiwi_coder/article/details/17575629 在《IntelliJ下使用Code/Live Template加快编码速度...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:SQLException: The server time zone value '�й���׼ʱ��' is unrecognized
举报原因:
原因补充:

(最多只允许输入30个字)