mysql默認(rèn)服務(wù)器時(shí)區(qū)問(wèn)題:修改jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8為
jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8
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.
字面意思 mysqljdbc . driver。這是被棄用的。新的驅(qū)動(dòng)類(lèi)是“com.mysql.cjdbc.driver”。驅(qū)動(dòng)程序通過(guò)SPI自動(dòng)注冊(cè),而手動(dòng)加載類(lèi)通常是不必要的。
那么我只需要把?com.mysql.jdbc.Driver 改為com.mysql.cj.jdbc.Driver 即可
java.sql.SQLException: The server time zone value '?D1ú±ê×?ê±??' is unrecognized or represents more than one time?
從錯(cuò)誤上看應(yīng)該是時(shí)區(qū)的錯(cuò)誤,因此只需要設(shè)置為你當(dāng)前系統(tǒng)時(shí)區(qū)即可
static final? String DB_URL="jdbc:mysql://localhost:3306/csm"+"?serverTimezone=GMT%2B8";
加上?serverTimezone=GMT%2B8" 即可? GMT%2B8代表: 東八區(qū)
GMT%2B8代表是東八區(qū)
---------------------