今天在使用JDBC连接数据库时出了一点问题:

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

(这不是主要的,因为我使用了当前最新的mysql-connector-java-8.0.9-rc.jar的MySQL驱动包,新的驱动包中`com.mysql.jdbc.Driver'类已经过时,新的`com.mysql.cj.jdbc.Driver'通过SPI自动注册,不再需要手动加载驱动类)

Sat Apr 14 14:18:21 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.

(这也不是主要的:不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果不设置显式选项,则必须建立默认的SSL连接。为了兼容不使用SSL的现有应用程序,verifyServerCertificate 属性被设置为“false”。您需要通过设置useSSL=false来显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储。)

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:127)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:61)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:71)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:874)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:234)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:227)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.mytestings.mysql.MySQLDemo.main(MySQLDemo.java:23)

Caused by: com.mysql.cj.core.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.

就是上面标红的SQL异常,我们需要在数据库 URL中设置serverTimezone属性:

static final String DB_URL = "jdbc:mysql://localhost:3306/RUNOOB" +"?serverTimezone=GMT%2B8";

这里的  GMT%2B8  代表是东八区。

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone问题解决相关推荐

  1. 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 ...

  2. The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

    场景 运行Mybatis的generator自动生成代码时提示: caused by :The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognize ...

  3. 解决Hibernate报错The server time zone value is unrecognized or represents more than one time zone

    解决Hibernate报错The server time zone value is unrecognized or represents more than one time zone   笔者在使 ...

  4. The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

    Spring Cloud启动jdbc报错 1.Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The s ...

  5. JDBC报错:The server time zone value is unrecognized or represents more than one time zone 已解决

    一.详细报错信息 Caused by: java.sql.SQLException: The server time zone value is unrecognized or represents ...

  6. The server time zone value is unrecognized or represents more than one time zone. 这个问题的解决方法

    我在用spring boot开发jpa的时候,发现了这个问题: The server time zone value '???ú±ê×??±??' is unrecognized or represe ...

  7. 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 ...

  8. 解决The server time zone value ‘Öйú±ê׼ʱ¼ä‘ is unrecognized or represents more than one time zone问题

    问题描述 数据库配置如下 spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://192.168. ...

  9. 【杂文】spring-boot报错 ~ zone value ‘Öйú±ê׼ʱ¼ä‘ is unrecognized or represents more than on time zone.

    spring-boot报错 zone value 'Öйú±ê׼ʱ¼ä' is unrecognized 修改MySQL的配置文件(failed) 更改MySQL中的系统时间(failed) 修 ...

最新文章

  1. JavaScript 笔记 ( Prototype )
  2. 数据库事务及锁机制介绍
  3. 天翼云从业认证(1.3)了解数据库的概念、SQL、关系型数据库、大数据和 NoSQL 数据库
  4. 每周一书《Spark与Hadoop大数据分析》分享!
  5. Java IdentityHashMap values()方法与示例
  6. python常用函数import_python 常用函数集合
  7. mysql创建表时表明加单引号_python在MySQL表名周围插入单引号(‘)
  8. C语言深入理解系列 - 关键字:auto和register
  9. Android——最全的系统对话框(AlertDialog)详解
  10. vrep中的运动规划(主要是针对机械臂)(未完)
  11. 计算机42D,汉印G42D 电子面单打印机
  12. GoLang使用sync.Once
  13. Pandas 那些年踩过的坑
  14. 某游戏客户流失情况数据分析
  15. 五秒去除视频水印,这么简单的方法一定要收藏!
  16. 微信小程序真机调试常见问题汇总
  17. 记录微星gl63的ubuntu 18.04重装rtl8821ce驱动,重获wifi
  18. Tcpdump 命令——筑梦之路
  19. 春天猫rtsy_您最近见过春天吗?
  20. python登录网易163邮箱,爬取邮件

热门文章

  1. Python简明手册-转自啄木鸟社区
  2. cookie实现自动登陆原理
  3. c/c++数据结构之深度寻路算法基础(含自己写的源码)
  4. JQuery-Demo5:图片广告位
  5. python表面瑕疵检测_python – OpenCV检测水果上的划痕
  6. JAVA毕设项目律师事务管理系统(java+VUE+Mybatis+Maven+Mysql)
  7. 营造好的气氛有助于拍出好的婚纱照
  8. 干货 | 想学数据分析不知道该读什么书、从哪本读,翻遍专业知识类网站最全的整理!
  9. 卡西欧计算机的闹铃怎么取消,卡西欧如何关闭闹钟
  10. LabVIEW入门第七天(数值控件)