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版本號,配置數據源時的驅動。