1. 程式人生 > >解決辦法 : Loading class `com.mysql.jdbc.Driver'. This is deprecated...

解決辦法 : Loading class `com.mysql.jdbc.Driver'. This is deprecated...

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.
原因就是舊版的driver不相容新版的driver(6.0以上)了, 需要改變以下幾點(粗體)

driverClassName=com.mysql.
cj.jdbc.Driver //舊版是com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false //需要指定時區serverTimezone: username=root password=123456