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