spring-boot 再添加mysql启动器的时候报错, The driver is automatically registered via the SPI and manual loading of the driver class....

mysql驱动更新迭代之后驱动,稍微有点变化:

com.mysql.jdbc.Driver (变化为) --> driver-class-name: com.mysql.cj.jdbc.Driver

还有就是另一个报错

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration

这个是由于时区的问题,之前在SSM中 这样写是没有问题的,

jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8


但是换spring boot之后,可能是自动匹配新版本的原因吧,导致的,更换为

jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
没有问题了,
完整的yml配置数据库的配置
spring:
datasource:
# driver-class-name: com.mysql.jdbc.Driver com.mysql.cj.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

做个备忘,防止以后出现类似的问题,节省时间

 

 

你可能感兴趣的:(spring-boot 再添加mysql启动器的时候报错, The driver is automatically registered via the SPI and manual loading of the driver class....)