1.启动报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.错误
2.访问时报java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
应该是在配置mysql时,没有指定mysql的版本,而采用默认的版本,默认的版本过高,本地版本低。
因为在 mysql5 中,jdbc 的驱动是 com.mysql.jdbc.Driver,而 mysql6 及以上是 com.mysql.cj.jdbc.Driver。
所以在配置依赖时要配置mysql版本号,配置数据源时的驱动。