连接mysql一直报时区错误,跟着网上改了很多都没用?请问老师怎么解决啊?

来源:2-4 代码关联Git远程仓库

pandaBgc

2021-03-06

Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate (default-cli) on project wiki: 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 specific time zone value if you want to utilize time zone support.

写回答

3回答

pandaBgc

提问者

2021-03-06

哇哇哇,同学们,我解决了,我在application.properties中像这样改了一下,真的是要哭了~~

spring.datasource.url=jdbc:mysql://localhost:3306/wiki?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
spring.datasource.username=你的username
spring.datasource.password=你的password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

mybatis.mapper-locations=classpath:/mapper/**/*.xml

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8


0
1
pandaBgc
我上面贴的错误是利用mybatis代码生成器产生的错误
2021-03-06
共1条回复

pandaBgc

提问者

2021-03-06

//img1.sycdn.imooc.com/szimg/604342bf0970cbbf08290485.jpg在cmd查看时间是对的,但是mybatis一做数据库查询就是比现在的时间少8小时,我试过cmd中修改时区和mysql中配置文件修改时区,但是现在还是报错。。。像下面这样,哭了!

//img.mukewang.com/szimg/60434316093e055c10100491.jpg

0
0

普粹

2021-03-06

//img.mukewang.com/szimg/60432c9e09f0a34a09050712.jpg

我的是这样设置就不报错了

0
1
pandaBgc
哇哇哇!谢谢你!我试过这样改了,但是依旧报错,我在cmd查看时间是对的,但是mybatis一做数据库查询就是比现在的时间少8小时,我试过cmd中修改时区和mysql中配置文件修改时区,但是现在还是报错。。。
2021-03-06
共1条回复

Spring Boot+Vue3前后端分离,实战wiki知识库系统

一课掌握前后端最火框架,更有职场竞争力

2524 学习 · 1671 问题

查看课程