当前位置: 代码迷 >> 综合 >> 【问题集萃】N003:SpringBoot2连接MySQL数据库,启动时报错:The new driver class is `com.mysql.cj.jdbc.Driver'.
  详细解决方案

【问题集萃】N003:SpringBoot2连接MySQL数据库,启动时报错:The new driver class is `com.mysql.cj.jdbc.Driver'.

热度:23   发布时间:2024-01-26 12:01:18.0

连接MySQL数据库,启动时报如下错误

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.

解决对策:按照提示,将配置文件中访问MySQL连接的驱动名称修改如下。

#修改MySQL的驱动名
#spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
?

 

  相关解决方案