【异常】The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
异常错误: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.
Thu Sep 27 00:18:47 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:832)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.jdbc.chap02.sec03.Demo1.main(Demo1.java:33)
Caused by: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:128)
at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2236)
at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2260)
at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1314)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:963)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:822)
... 6 more
我用了8.0版本的MySQL连接驱动。现在按照最新官方提示支持将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver
//驱动名称
private static String jdbcName = "com.mysql.cj.jdbc.Driver";
//数据库地址
private static String dbUrl = "jdbc:mysql://localhost:3306/db_book";
//数据库用户名
private static String dbUser = "root";
//数据库密码
private static String dbPassword = "123456";
我们还需要在访问数据库的Url后面加上以下的语句即可:
private static String dbUrl = "jdbc:mysql://localhost:3306/db_book?serverTimezone=GMT%2B8"
从错误上看应该是时区的错误,所以我们只需要设置完毕系统的时区即可。这里的GMT%2B8
代表东八区。
还有一种解决办法就是设置整个数据库的时区,可以执行下面的语句来完成:
show variables like '%time_zone%'
set global time_zone='+8:00';
#执行结果:
Variable_name Value
system_time_zone
time_zone SYSTEM
【异常】The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.的更多相关文章
- 解决mysql时区与系统时区不一致问题。异常:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
异常信息:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone ...
- MySql数据库时区异常,java.sql.SQLException: The server time zone value '?й???׼ʱ?' is unrecognized or represents more than one time zone.
JDBC访问MySql异常 Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException ...
- 异常: 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 configurat
异常: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. ...
- spring boot启动异常: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
项目启动时提示:java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represen ...
- 【JDBC】java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
在使用阿里的druid 时,报了一个异常java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized ...
- com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 问题解决方法
一.问题 今天用mybatis连接数据库时出现了如下错误: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The serve ...
- SpringBoot报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone
解决方法: 在数据库连接url配置后边加&serverTimezone=GMT%2B8 例: jdbc:mysql://127.0.0.1:3306/test改为jdbc:mysql://12 ...
- The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
今天用mysql连接数据库时,出现The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than o ...
- JDBC告警系列(一)The server time zone value 'ÖÐ' is unrecognized or represents more than one time zone.
一.现象 java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents ...
随机推荐
- db2-表处于暂挂状态
有时当对表数据进行操作时,表锁了,处于暂挂状态,网上搜的大部分不能解决的话可以尝试用以下语句进行解锁 call sysproc.admin_cmd('reorg table 表名')
- 【转】大数据批处理框架 Spring Batch全面解析
如今微服务架构讨论的如火如荼.但在企业架构里除了大量的OLTP交易外,还存在海量的批处理交易.在诸如银行的金融机构中,每天有3-4万笔的批处理作业需要处理.针对OLTP,业界有大量的开源框架.优秀的架 ...
- mybatis批量插入insert时报错
报错信息: 传入的表格格式数据流(TDS)远程过程调用(RPC)协议流不正确.此 RPC 请求中提供了过多的参数.最多应为2100 错误分析: 由于mybatis拼接的sql语句参数过多导致 解决办法 ...
- Docker 清理命令汇总
杀死所有正在运行的容器 docker kill $(docker ps -a -q) 删除所有已经停止的容器 docker rm $(docker ps -a -q) 删除所有未打 dangling ...
- jquery 滑块导航菜单
带滑块的导航菜单,鼠标悬浮时,滑块会移动至鼠标位置,离开时,滑块会回到原来的位置,点击菜单之后滑块会停留在被点击菜单位置,等待下一次的鼠标悬浮事件或者点击事件,效果图: 图片效果不行,直接上代码: & ...
- 【从业余项目中学习1】C# 实现XML存储用户名密码(MD5加密)
最近在写一个C#的项目,用户需求是实现Winform的多文档界面与Matlab算法程序之间的交互.做了一段时间发现,这既能利用业余时间,实战中也可学习一些技术,同时刚毕业也增加一份收入.所以后面会不断 ...
- struts2 中使用DMI(动态调用方法)方式配置action
1.使用 "!"方式,即 action名称 ! 方法名称 struts.xml 配置 <package name="user" namespace=&qu ...
- 笨办法学Python(三十)
习题 30: Else 和 If 前一习题中你写了一些 “if 语句(if-statements)”,并且试图猜出它们是什么,以及实现的是什么功能.在你继续学习之前,我给你解释一下上一节的加分习题的答 ...
- python 笔记1:官网下载及安装python;eclipse中安装配置pydev
1 下载安装python. 官网:https://www.python.org/downloads/ 根据自己的操作系统选择需要的版本下载并安装. 我的电脑操作系统windows xp的,只 ...
- Jmeter入门8 连接microsoft sql server数据库取数据
本文以Jmeter 连接microsoft sql server为例. 1 从微软官网下载Microsoft SQL Server JDBC Driver 地址:http://www.microsof ...