MySQL5.7
spring.datasource.url=jdbc:mysql://192.168.31.200:3306/xxl_job?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
MySQL8.0
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
这篇博客介绍了MySQL 5.7和8.0两个版本的数据库连接配置,包括URL、用户名、密码和驱动类名。在MySQL 8.0中,可以看到URL增加了autoReconnect参数和serverTimezone设置为Asia/Shanghai,同时驱动类名更改为com.mysql.cj.jdbc.Driver。此外,还给出了MySQL 8.0的依赖包版本为8.0.23。
1411





