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.


特別提示:本人博客部分有參考網絡其他博客,但均是本人親手編寫過並驗證通過。如發現博客有錯誤,請及時提出以免誤導其他人,謝謝!歡迎轉載,但記得標明文章出處: http://www.cnblogs.com/mao2080/

1、問題描述

本地程序執行是OK,但是發布到Linux上,MySQL設置的UTC時間,在執行數據庫操作的時候,就會報如下錯誤:
Failedjava.sql.SQLException: The server time zone value 'Coordinated Universal Time' 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、解決方法

在db連接串后面加上:?serverTimezone=UTC,完整示例:jdbc:mysql://localhost:3306/dbname?serverTimezone=UTC【可以指定時區問題】

3、拓展知識

在db連接串后面加上:?useUnicode=true&characterEncoding=UTF-8,完整示例:jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=UTF-8 【可以解決中文亂碼問題】

當然也可以聯合起來用jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

4、參考網站

https://blog.csdn.net/aayygg1234/article/details/78205240


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱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