使用连接mysql的jdbc驱动最新版引发的问题
我的配置
spring.datasource.url = jdbc:mysql://localhost:3306/testcharacterEncoding=utf-8&allowMultiQueries=true
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
运行时报出异常
Caused by: 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.
解决方法
修改url配置,加上serverTimezone=UTC
spring.datasource.url = jdbc:mysql://localhost:3306/test?serverTimezone=UTC&characterEncoding=utf-8&allowMultiQueries=true