MySQL8连接配置


1.连接驱动类改为”com.mysql.cj.jdbc.Driver”

在之前的驱动类(com.mysql.jdbc.Driver.class)下有这样一段:

static {
        System.err.println("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.");
    }

意思就是要更换驱动类

2.连接url参数配置

需要再url中指明编码格式,SSL,时区等信息
完整配置:

 url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8

文章作者: niww
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 niww !
 上一篇
JS中byte转String乱码 JS中byte转String乱码
项目中遇到一个问题,在JS中将byte数组转化为String的时候,有中文的情况下会出现乱码问题: function decodeToString(payload) { return String.fromCharCode.apply(
2020-04-23
下一篇 
SpringCloud之application.properties和bootstrap.properties区别 SpringCloud之application.properties和bootstrap.properties区别
一、执行顺序 bootstrap.yml(bootstrap.properties)先加载,application.yml(application.properties)后加载bootstrap.yml(bootstrap.properti
2020-04-03
  目录