连接MySQL
引入依赖
<!-- mysql 5 -->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>5.1.27</version>-->
<!-- </dependency>-->
<!-- mysql 8 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
Yaml配置
# 数据库连接信息
spring:
datasource:
#MySQL 5
#driver-class-name: com.mysql.jdbc.Driver
#MySQL 8
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.125:3306/ithink-cms?serverTimezone=UTC&useSSL=false
username: root
password: aaaaaa
常见问题