在连接数据库时,使用了最新版本的mysql-Connector,即6.0以上版本

1、报错如下:

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

解决方法:

  1. jdbc.driverClassName=com.mysql.jdbc.Driver 修改为
  2.  
  3. jdbc.driverClassName=com.mysql.cj.jdbc.Driver

2、报错如下:

  1. 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.
  2. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60]
  3. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60]
  4. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60]
  5. at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60]

解决方式:

在jdbc连接url中加入属性serverTimezone,即需要指定时区。例如:

  1. jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=gbk&useSSL=true
  2.  
  3. &useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Hongkong

serverTimezone只是扩展:

  1、选择东8区的Hongkong、Asia/Shanghai或者Asia/Hongkong作为参数

  2、serverTimezone=GMT%2B8表示北京时间

使用springboot最新版本mysql-Connector连接数据库时报错解决的更多相关文章

  1. 高版本 MySQL 导出的脚本到低版本 MySQL 中执行时报错

    导入 MySQL 脚本时报错:[ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'低版本还不支持 utfmb4 这个字符集 解决方法:将 sql 脚 ...

  2. Windows7 64位安装最新版本MySQL服务器

    Windows7 64位安装最新版本MySQL服务器 近期,一直在研究MySQL数据库,经常修改配置文件,导致MySQL数据库无法使用,不得不反复重装MySQL数据库.以下是在Windows7 64位 ...

  3. db2的select语句在db2 client上执行正确,JDBC连接数据库时报错

    db2的select语句在db2 client上执行正确,JDBC连接数据库时报错. sql语句是:select ...from QUALIFIER.tableName fetch first 21 ...

  4. 【转载】Mysql创建表时报错error150

    从mysql数据库中导出正常数据库的脚本语句,而后使用脚本语句创建数据库的过程中,执行语句提示Can't Create Table 'XXX' erro150的错误,语句执行中断,创建table失败, ...

  5. phpstudy2016最新版本mysql无法使用innodb的问题解决

    这里顺便记录一下今天遇见的神奇问题,在使用官方最新版本的phpstudy中,其它组件一切正常,但是奇怪的发现mysql是无法开启innodb的,以下为最新的下载地址: http://www.phpst ...

  6. mysql数据库导出时报错mysqldump: Got error: 145的解决方法

      在给mysql数据库备份时,报错:mysqldump: Got error: 145: Table './jxzhtopenfire/ofoffline' is marked as crashed ...

  7. 实践丨SpringBoot整合Mybatis-Plus项目存在Mapper时报错

    摘要:在SpringBoot运行测试Mybatis-Plus测试的时候报错的问题分析与修复 本文分享自华为云社区<SpringBoot整合MybatisPlus项目存在Mapper时运行报错的问 ...

  8. 使用vue框架运行npm run dev 时报错解决

    使用使用vue框架运行npm run dev 时报错 如下: 原因: localhost:8080 有可能其他软件占用了,导致其他问题的出现 我们可以动态修改地址 解决: 进入项目文件的config文 ...

  9. rebuild online时意外中断 再次重建时报错解决方法

    rebuild online时意外中断 再次重建时报错 SQL> alter index PARTY.IDX_CM_INDIV_CUSTOMER_4 rebuild online; alter ...

随机推荐

  1. 🕸捕获与改写HTTPS请求

    前言 本文站在 macOS 用户的角度下,分享一下对 HTTPS 进行请求拦截.对响应进行修改的经验. 要注意的是,本文介绍的工具虽然一定程度上对 Windows 用户也适用 ,但并非所有工具都是免费 ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——菜单 (十六)

    系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) ...

  3. JavaScript img标签自带的onload和onerror函数

    onload 加载完成时调用触发 原生: <img src="" alt="Park" onload=“handleImageLoaded()”/> ...

  4. HDU-3549Flow Problem 最大流模板题

    传送门 这里是Ford-Fulkerson写的最大流模板 #include <iostream> #include <cstdio> #include <algorith ...

  5. SpringBoot项目创建及入门基础

    一:快速构建springboot项目 进入https://start.spring.io/,选择相应的springboot版本,包名,项目名,依赖 图中选择web,利用tomcat服务器进行开发 sp ...

  6. Codeforces 919D Substring (拓扑排序+树形dp)

    题目:Substring 题意:给你一个有向图, 一共有n个节点 , m条变, 一条路上的价值为这个路上出现过的某个字符最多出现次数, 现求这个最大价值, 如果价值可以无限大就输出-1. 题解:当这个 ...

  7. hdu 3065病毒侵袭持续中(ac自动机)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3065 中文题题意不解释了. 依旧稍微改一下ac自动机模版就能过了.还有一个坑点!是多组数据!!! #i ...

  8. HDU 5451 Best Solver 数论 快速幂 2015沈阳icpc

    Best Solver Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 65535/102400 K (Java/Others)Tota ...

  9. 4、cesium场景出图,打印图件

    cesium场景出图,打印图件 把3d渲染的页面进行截图,并可以下载到本地:代码如下: function printscreenScene() { var image = new Image();// ...

  10. 在Linux中增加swap空间

    转自: http://blog.csdn.net/chinalinuxzend/article/details/1759593 在Linux中增加swap空间 在安装Linux的时候,不知道swap空 ...