MySql5.x升级MySql8.x的方法步骤

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

MySql5.x升级MySql8.x的方法步骤

  2021-04-02 我要评论

Mysql5.x与Mysql8.0.X的几点不同

application.properties的不同
被注释掉的对应 8.0.x 版本的内容.

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
//spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.datasource.username=root//你的用户名.默认root
spring.datasource.password=123456//你的密码.默认root

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sell?characterEncoding=utf-8&useSSL=false
//spring.datasource.url=jdbc:mysql://127.0.0.1:3306/sell?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=UTC

spring.jpa.show-sql=true

server.context-path=/sell
//server.servlet.context-path=/sell

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%2B8

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

您可能感兴趣的文章:

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们