zoukankan      html  css  js  c++  java
  • 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
    愿你眼中有光芒,活成你想要的模样
  • 相关阅读:
    python 注释
    python元祖
    浅谈单片机应用程序架构----本质是定时调用
    原子哥的STM32视频,我发现他们都看不懂原子哥里面按键扫描程序
    指针函数与函数指针的区别
    基于不带字库的图形LCD模块汉字显示解决方案
    GB2312编码
    C语言可变参简介
    kEIL5环境下移置STM32库文件
    nodejs表单验证
  • 原文地址:https://www.cnblogs.com/SmallStrange/p/13986208.html
Copyright © 2011-2022 走看看