欢迎光临
我们一直在努力

nested exception is java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä’

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.Tue Apr 30 21:15:36 CST 2019There was an unexpected error (type=Internal Server Error, status=500).nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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. ### The error may exist in com/mkl/mapper/UserMapper.java (best guess) ### The error may involve com.mkl.mapper.UserMapper.selectByPrimaryKey ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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.

这是今天在学习spring cloud的时候,连接数据库出现的bug,用的spring的手脚架创建的项目,看了下是MySQL默认的时区是UTC时区 的问题,临时解决方法是在连接地址后面跟?serverTimezone=GMT%2B8,也就是这样jdbc:mysql://localhost:3306/mybatis?serverTimezone=GMT%2B8,现在能正常获取数据了,永久解决的话:修改mysql的配置文件,添加:default-time-zone=’+08:00’,重启mysql生效

赞(1) 打赏
未经允许不得转载:三体IT-个人开发学习 » nested exception is java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä’
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

专注Java后端技术 我在努力

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏