MySql5.x升级MySql8.x

时间:2022-05-04 04:36:32

MySql5.x升级MySql8.x非常简单,一般来说只需要操作两个步骤即可

1. 替换新的jar包

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.18</version>
</dependency>

2. 替换新驱动类

com.mysql.cj.jdbc.Driver

3. 替换新url连接,需要指定时区

# 设定时间为东八区
serverTimezone=GMT+8

# 完整url
String url="jdbc:mysql://" dbHost ":" dbPort "/" dbName "?"
          "serverTimezone=GMT+8&useUnicode=true&characterEncoding=utf-8"
          "&port=" dbPort "&autoReconnect=true";