连接MySql出现异常解决:java.sql.SQLException: The server time zone value is unrecognized or represents。
QUESTION:
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.
ANSWER:
一:原因
博主在刚开始学习SpringBoot的时候,整合mybatis框架使用MySql数据库配置时出现以上问题,经过查阅资料,找到解决方案,
原因是因为使用了Mysql Connector/J 6.x以上的版本,然后就报了时区的错误
遇到的问题 servertime=UTC导致时间差8个小时
二:解决方法
在配置mysql的URL加上时区:
serverTimezone=UTC
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/springboot?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
虽然上面加上时区程序不出错了,但是我们在用java代码插入到数据库时间的时候却出现了问题。
因为时区设置的问题。
UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。
UTC + (+0800) = 本地(北京)时间。
将时区改成中国标准时间:
serverTimezone=Asia/Shanghai
连接MySql出现异常解决:java.sql.SQLException: The server time zone value is unrecognized or represents。相关推荐
- java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents 解决方法
转载自https://blog.csdn.net/weixin_37577564/article/details/80329775 在JDBC使用的时候有时候会出现java.sql.SQLExcept ...
- java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more
** java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents mo ...
- java.sql.SQLException: The server time zone value ‘???ú±ê×??±??‘ is unrecognized or represents more
[报错信息] [百度翻译] 服务器时区值'???ú±ê×??±??'无法识别或表示多个时区.如果要利用时区支持,必须配置服务器或JDBC驱动程序(通过ServerTimeZone配置属性),以使用更具 ...
- JDBC编程可能遇到的错误:java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or ..
文章目录 1.错误提示: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 2.提示:Loading class com.mysql.jd ...
- 解决 java.sql.SQLException:The server time zone value xxx is unrecognized 问题
报错问题:Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.j ...
- java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä'
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more ...
- java.sql.SQLException: The server time zone value ‘�й���ʱ��‘ is unrecognized or represent.........
springboot整合mybatis时运行异常: java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecogn ...
- java.sql.SQLException: The server time zone value �й���ʱ�� is unrecognized or represents ...
使用springboot 整合mybatis项目启动控制台报错: java.sql.SQLException: The server time zone value '�й���ʱ��' is un ...
- java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized
在application.yml中 spring:datasource:username: rootpassword:url: jdbc:mysql://127.0.0.1:3306/testdriv ...
最新文章
- tomcat 目录配置 appBase和docBase 简介
- Boost:双图bimap与双向地图的测试程序
- 【BZOJ1500】[NOI2005]维修数列 Splay
- [HDU] 2553 N皇后问题-简单深搜
- thriftpy2使用与流程
- linux编写复制脚本程,常用的Shell脚本
- Draconian,自由或保姆状态:Java,C#,C,C ++,Go和Rust中的并发意识形态
- WSL2支持GPU使用docker
- Android Jni开发-实战篇(CMake)
- ubuntu安装labelImg
- 混频器的噪声来源与抑制方法
- java swing tooltips_【Unity笔记】提示框ToolTips大小自适应,及其闪烁的问题
- 请上传android安装包,如何上传APP到各大安卓应用市场
- vbox虚拟机和vm虚拟机 虚拟机网络不通的解决方法
- Rinne Loves Dynamic Graph
- Ubuntu 两步安装 Teamviewer 最新版本(官方方法)
- python把中文文档变为拼音
- 同一个module里面多个initial是并行的吗
- Android TV机顶盒开发简单介绍
- 【Festo仿生】放大招丨你见过比他灵活的“机械手”吗?
热门文章
- 图解,C语言希尔排序
- Linux字符设备驱动实例
- 分号是不是c语言的一部分,问什么C程序里总是提示缺少分号;,而明明有分号?...
- STM32——系统滴答定时器
- 学习Java中遇到的问题积累_1
- 一、数据预处理——数据归一化 数据标准化
- LeetCode 1681. 最小不兼容性(回溯+剪枝)
- LeetCode 381. O(1) 时间插入、删除和获取随机元素 - 允许重复(vector + 哈希)
- LeetCode MySQL 185. 部门工资前三高的所有员工(dense_rank)
- LeetCode 1474. 删除链表 M 个节点之后的 N 个节点