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.


1、打開網頁時候報錯,idea報錯

 

 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.

2、時區問題

 

 

啟動springboot項目,然后訪問數據庫,報You must configure either the server or JDBC driver (via the serverTimezone conf)的錯誤,原因

因為安裝mysql的時候時區設置的不正確 mysql默認的是美國的時區,而我們中國大陸要比他們遲8小時,采用+8:00格式

 

使用的數據庫是MySQL,從上面圖看出SpringBoot2.3在你沒有指定MySQL驅動版本的情況下它自動依賴的驅動是8.0.12很高的版本,這是由於數據庫和系統時區差異所造成的,在jdbc連接的url后面加上serverTimezone=GMT即可解決問題,如果需要使用gmt+8時區,需要寫成GMT%2B8,否則會被解析為空。再一個解決辦法就是使用低版本的MySQL jdbc驅動,5.1.28不會存在時區的問題。

加上這個  ?serverTimezone=UTC 

spring.datasource.url=jdbc:mysql://localhost:3306/online_ssm?serverTimezone=UTC

spring.datasource.driver-class-name =com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/online_ssm?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=qw123456

3、問題解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 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. 解決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問題 使用JDBC連接MySql時出現: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 報錯:Cannot create PoolableConnectionFactory (The server time zone value 'CST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverT spring2.0:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either th 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 三、SpringBoot啟動時JDBC報錯:You must configure either the server or JDBC driver (via the serverTimezone configuration property) springboot啟動過程中出現You must configure either the server or JDBC driver (via the serverTimezone configuration JDBC driver連接MySQL運行報錯The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than 關於MySql升級JDBC架包導致時區問題報錯(The server time zone value '?й???????' is unrecognized or represents more than one time zone)
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM