Mysql8.0 连接的坑

今天做demo第一次用到 MuSQL8,之前一直用的 MySQL5.7,由于8有一些新特性,遂想使用新版本。不过在配置连接时有一些需要注意的点。

1:jdbcDriver: 需要使用带cj的:

com.mysql.cj.jdbc.Driver

2:jdbcUrl: jdbc:mysql://localhost:3306/sunsas?3useUnicode=true&serverTimezone=GMT

应该写个时区,否则报:The server time zone value is unrecognized or represents more than one time zone

依赖引入:

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

  

我之前一直报 A ResourcePool could not acquire a resource from its primary factory or source 应该就是这两个写错导致。

原文地址:https://www.cnblogs.com/SunSAS/p/14956685.html