启动项目报错Loading class `com.mysql.jdbc.Driver'. This is deprecated.

一、问题描述

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

二、问题解决

1、整合springboot用到最新的mysql 连接驱动
以前的版本

spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/kedarjxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
spring.datasource.username = root
spring.datasource.password = 1111

需要将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver

2、更改的新版驱动之后会报错,sql时间的问题。
搜索my.ini文件在 [mysqld] 下添加 default-time-zone=’+08:00’ 后 再重启sql 服务就好了。

[mysqld]
default-time-zone='+08:00'
# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking
# enable-named-pipe
# shared-memory

# shared-memory-base-name=MYSQL

# The Pipe the MySQL Server will use
# socket=MYSQL

# The TCP/IP Port the MySQL Server will listen on
port=3306

你可能感兴趣的:(Spring)