欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb

程序员文章站 2024-03-14 16:57:16
...

启动了下别人的项目,报错
Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb
下面接着还报了几个rabbitmq线程warn,好怕怕哦,这可咋整。属实把人家吓坏了呢。

解决:
按他说的,把.yml里

spring:
    datasource:
        url: jdbc:mysql://localhost:3306/tfboys
        driverClassName: com.mysql.jdbc.Driver
        username: root
        password: 123456

换成

spring:
    datasource:
        url: jdbc:mysql://localhost:3306/tfboys?serverTimezone=UTC
        driverClassName: com.mysql.cj.jdbc.Driver
        username: root
        password: 123456

就完事了。