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: 數據庫密碼