1. 导入MySQL依赖
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
2. application.yml中配置
spring:
datasource:
url: jdbc:mysql://IP地址:端口号/数据库名?serverTimezone=GMT%2B8&useServerPrepStmts=true&rewriteBatchedStatements=true
username: 数据库用户名
password: 数据库密码