Java spring boot 2.0连接mysql异常:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represent
控制台报错信息
com.mysql.cj.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
页面报错信息
解决办法:
由于时区不y一致导致的问题,可以指定时区,在URLl连接里:
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/yitianb2b?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=GMT%2B8&useSSL=false
spring.datasource.driverclassname=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123
在此记录一下避免遗忘!