【转载】在使用JDBC连接MySql时报错: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时报错: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.
具体报错如下:
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.
在这里说一下为什么会出现这样的问题,因为我创建的是springboot项目,在pom中添加mysql依赖,并没有设置版本号,因为springboot内部配置过了。它配置的版本号是8.0.13 就是因为mysql的版本太高了,所以才会出现这个报错。
如果你加载mysql比较低的版本,则不会有这种情况了。
解决方法:
在配置文件中的 连接字符串后面加上?serverTimezone=UTC
UTC是统一标准世界时间
完整的连接字符串示例:jdbc:mysql://localhost:3306/hello?serverTimezone=UTC
如果指定使用gmt+8时区,需要写成GMT%2B8,否则可能报解析为空的错误
顺便一提,如果输入中文存在乱码,可以如下设置:
jdbc:mysql://127.0.0.1:3306/hello?useUnicode=true&characterEncoding=UTF-8
当然,为了稳妥,你也可以都写上 如下:
jdbc:mysql://127.0.0.1:3306/hello?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
搞定。
---------------------
作者:weixin_42652696
来源:CSDN
原文:https://blog.csdn.net/weixin_42652696/article/details/83864740
版权声明:本文为博主原创文章,转载请附上博文链接!
【转载】在使用JDBC连接MySql时报错: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的更多相关文章
- 解决使用DBeaver连接MySQL时报错-The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.
解决使用DBeaver连接MySQL时报错,其实提示很明显. The server time zone value '�й���ʱ��' is unrecognized or represents ...
- 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
java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more tha ...
- 三、SpringBoot启动时JDBC报错:You must configure either the server or JDBC driver (via the serverTimezone configuration property)
错误提示: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connectio ...
- You must configure either the server or JDBC driver (via the serverTimezone configuration property
使用JDBC连接MySql时出现:The server time zone value '�й���ʱ��' is unrecognized or represents more than one ...
- Android jdbc连接mysql报错解决方案 (Communications link failure)
最近调试安卓连接mysql真是心态爆炸,快两天才搞出来.以下整理一些常见问题. 检查manifest文件里网络权限是否打开 检查数据库IP是否有问题(包括一些沙雕错误,比如是不是在ip首或尾多了个空格 ...
- python MySQLdb连接mysql时报错
故障现象: >>> import MySQLdb >>> conn = MySQLdb.connect(host=,charset="utf8" ...
- 使用navicat连接mysql时报错:2059 - authentication plugin 'caching_sha2_password'
首先从本地登录mysql数据库,进入mysql控制台,输入如下命令: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_passwo ...
- Ubuntu下使用mysqli-connect连接mysql时报错:ERROR 1698 (28000): Access denied for user 'root'@'localhost'
LNMP安装好后,写了个index.php文件,里面的内容很简单,就是想测试php与mysql的通信是否正常,代码如下: <?php $host = 'localhost'; $user = ' ...
- jdbc连接oracle时报错 Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableC
错误: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; ...
随机推荐
- HBase-概述
一种分布式.可扩展.支持海量数据存储的 NoSQL 数据库. 逻辑上,HBase 的数据模型同关系型数据库很类似,数据存储在一张表中,有行有列.但从 HBase 的底层物理存储结构(K-V)来看,HB ...
- 一台java服务器可以跑多少个线程?
一台java服务器能跑多少个线程?这个问题来自一次线上报警如下图,超过了我们的配置阈值. 京东自研UMP监控分析 打出jstack文件,通过IBM Thread and Monitor Dump ...
- nginx在windows系统中如何启动、重启、停止
nginx在windows系统中如何启动.重启.停止 查看nginx的版本号:nginx -v 启动nginx:start nginx 快速停止或关闭nginx:nginx -s stop 正常停 ...
- sed替换 - 含斜杠(\)和Shell变量
gen_image.bat中的内容如下: FOTARomPacker.exe -i .\_ini\FOTARomPacker.ini -o .\_Output\a.bin @IF %ERRORLE ...
- SpringBoot集成Spring MVC视图
SpringBoot在springmvc的视图解析器方面就默认集成了ContentNegotiatingViewResolver和BeanNameViewResolver,在视图引擎上就已经集成自动配 ...
- request cluster ID mismatch
删除了etcd集群所有节点中的--data_dir的内容 [root@node3 ~]# cd /var/lib/etcd/ [root@node3 etcd]# ls member [root@no ...
- Microsoft Visual Studio(VS)启动报安装过程中无法运行
开机启动VS提示无法运行,很可能VS正在更新,可以等待几分钟更新完成,再次运行VS. 也可以把更新进程结束,进程名:VSIXAutoUpdate.exe
- mysql删除某一个数据库中所有的表
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') FROM information_schema.tables WHERE table_s ...
- 求数值的n次方根
二分法 float SqrtByBisection(float n) //用二分法 { if(n<0) //小于0的按照你需要的处理 return n; float mid,last; floa ...
- 【Leetcode_easy】717. 1-bit and 2-bit Characters
problem 717. 1-bit and 2-bit Characters 题意:solution1: class Solution { public: bool isOneBitCharacte ...