1. 添加依赖
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>
<!--数据库连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.20</version>
</dependency>
2.配置文件信息
application.properties中数据库相关配置
##数据库地址
spring.datasource.url=jdbc:mysql://39.105.189.141:3307/db_yq1906?characterEncoding=UTF-8&&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=qfjava
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type: com.alibaba.druid.pool.DruidDataSource