jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url="jdbc:mysql://localhost:3306/guli?characterEncoding=UTF-8&useUnicode=true&useSSL=true&serverTimezone=UTC"
jdbc.username="root"
jdbc.password="aiwei111"
properties配置文件中的数据库配置如下,结果报错
四月 13, 2021 10:37:34 下午 com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl error
严重: create connection SQLException, url: "jdbc:mysql://localhost:3306/guli?characterEncoding=UTF-8&useUnicode=true&useSSL=true&serverTimezone=UTC", errorCode 0, state null
java.sql.SQLException: connect error, url "jdbc:mysql://localhost:3306/guli?characterEncoding=UTF-8&useUnicode=true&useSSL=true&serverTimezone=UTC", driverClass com.mysql.cj.jdbc.Driver
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1627)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468)
就是因为url加了双引号,因为直接copy网上的配置,正确配置如下
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/guli?characterEncoding=UTF-8&useUnicode=true&useSSL=true&serverTimezone=UTC
jdbc.username=root
jdbc.password=aiwei111