• mysql5.7升级8.0出现的问题


    出现的问题:

    1、问题:需要更新驱动的版本号问题

    could not create connection to database server 08001

    修改pom.xml:

    <dependency>
           <groupId>mysql</groupId>
           <artifactId>mysql-connector-java</artifactId>
           <version>8.0.11</version>
           <scope>runtime</scope>
     </dependency>

    MySQL8.0版本需要更换驱动为“com.mysql.cj.jdbc.Driver”,之前的“com.mysql.jdbc.Driver”已经不能在MySQL 8.0版本使用了,官方文档链接:https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-api-changes.html;

    描述如下:The name of the class that implements java.sql.Driver in MySQL Connector/J has changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. The old class name has been deprecated.

    另外mysql-connector-java也推荐更新到8.0的版本(https://dev.mysql.com/downloads/connector/j/)。

    2、问题:使用了 Mysql 最新版驱动

    The server time zone value '?й???????' is unrecognized or represents more than one time zone

    解决方案:

    1、一种是降版本,并不推荐,如果需要降版本5.5版本可以满足基本需要;

    2、还有一种是在jdbc连接的url后面加上serverTimezone=UTC或GMT即可,如果需要指定使用gmt+8时区,需要写成GMT%2B8,不然可能会报错误,解析为空

    jdbc.url=jdbc:mysql://localhost:3306/项目名称?serverTimezone=UTC&characterEncoding=utf-8
    愿你眼中有光芒,活成你想要的模样
  • 相关阅读:
    POJ 3007 Organize Your Train part II (字典树 静态)
    POJ 3096 Surprising Strings
    移动APP安全测试
    monkey亲测
    PHP笔记
    my sql 只展示 前10条数据的写法
    面试问的东西
    定时构建常用 设置
    jenkins 定时构建 位置
    jenkins 使用的python 不是指定的python 的解决方法
  • 原文地址:https://www.cnblogs.com/SmallStrange/p/13986208.html
Copyright © 2020-2023  润新知