1、注入mysql依赖

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

2、在application.properties中添加mysql源

spring.datasource.driver-class-name= com.mysql.jdbc.Driver #驱动
spring.datasource.url= jdbc:mysql://127.0.0.1:3306/mysql?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true #mysql源路径
spring.datasource.username= admin #账号
spring.datasource.password= admin #密码