spring项目连接mysql启动后,insert数据库 提示The server time zone value 'Öйú±ê׼ʱ¼ä'
解决办法:
执行:SET GLOBAL time_zone='+8:00'
若是在ubuntu环境下,直接在my.cnf文件中添加该行代码即可
还有种解决方式:在连接数据库配置的地方 添加 serverTimezone=GMT%2B8
比如我的
spring:
datasource:
url: jdbc:mysql://192.168.55.237:8081/styy_auth?useUnicode=true&characterEncoding=UTF-8&useSSL=false&jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&useAffectedRows=true&serverTimezone=GMT%2B8
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
minimum-idle: 5
maximum-pool-size: 15
connection-test-query: SELECT 1
max-lifetime: 1800000
connection-timeout: 30000
pool-name: DatebookHikariCP
redis:
database: 0
host: 127.0.0.1
port: 6379
password: null
timeout: 5000ms
jedis:
pool:
max-active: 100
max-idle: 10
max-wait: 100000ms