Spring連接數(shù)據(jù)庫異常:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or re...

軟件開發(fā),為了滿足開發(fā)的需要,jar包版本的更新或bug的修復(fù),會(huì)造成 版本不兼容,出現(xiàn)新問題,程序員就是為解決問題出現(xiàn)的,一句話就是我們愛折騰,樂此不彼。

異常錯(cuò)誤:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

出現(xiàn)這種問題還是版本更細(xì),與其他版本造成 ? ?

顯示新版本的數(shù)據(jù)庫連接程序需要指定UTC時(shí)區(qū),改正方法將配置文件中的“url”后面加上指定的時(shí)區(qū),將其值改為“url=jdbc:mysql://localhost:3306/db&serverTimezone=GMT”

改之前:

jdbc.driverClass? = com.mysql.cj.jdbc.Driver

jdbc.url = jdbc:mysql:///db?useUnicode=true&characterEncoding=utf8

jdbc.username = root

jdbc.password = 123456

改之后:

jdbc.driverClass? = com.mysql.cj.jdbc.Driver

jdbc.url = jdbc:mysql:///db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT

jdbc.username = root

jdbc.password = 123456

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容