【转载】在使用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; ...
随机推荐
- LayUI使用弹窗重载父级数据表格的两种方法
参考LayUI官方文档,在子窗口中重载父级数据表格找到以下两种方法: 1.子窗口中重载:在子窗口中直接调用父级talbe的reload方法. $("body").on(" ...
- mysql 触发器语法详解
1.创建Mysql触发器: 语法: CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR EACH ROW BE ...
- python -- 安装 django
django-admin startproject 创建的文件名python3/python manage.py startapp 子项目名称python3/python manage.py runs ...
- 猎豹网校C++ Primer学习笔记
1.头文件(15th课) 大型项目开发,要有很多头文件.只能写声明,不能定义(类定义和常量定义可以). 自己新建头文件(类定义,外部变量声明,函数声明).源文件包含对应的头文件. 头文件里写类的声明, ...
- 你真的懂wait、notify和notifyAll吗
生产者消费者模型是我们学习多线程知识的一个经典案例,一个典型的生产者消费者模型如下: public void produce() { synchronized (this) { while (mBuf ...
- jenkins参数化构建&HTML报告
背景: 每次构建项目时都需要去修改一下配置,然后保存,再去立即构建.这样修改容易修改出错误,影响到执行脚本,且每次都要去修改配置,不容易修改,操作也比较麻烦.所以决定将Jenkins修改为参数化构建. ...
- iOS 字符串和图片互转
for (UIImage *myImg in _imgArray) { NSData *imageData = UIImageJPEGRepresentation(myImg,0.5); NSStri ...
- win7下Excel2003/2010 同时打开多个独立窗口
最近新买了本本,装了许多软件,由于许多苦逼的原因系统被我搞的乱乱的,不得已重装了几次,话说之前我用的都是台式机,用得蛮顺的,但是在重装系统之后发现自己装的Office 2003 在打开Excel 文档 ...
- Kingbase数据库web统一管理平台
1.安装Kingbase金仓数据库后,通过打开web管理平台,可以方便的进行远程维护. 示例地址:https://192.168.0.1:54328/webstudio 2.输入用户名密码登 ...
- charles 批量重复请求/重复发包工具
本文参考:charles 批量请求 重复发包工具/repeat Charles 让你选择一个请求并重复,在测试后端接口的时候非常有用: Charles将请求重新发送到服务器,并将响应显示为新请求. 如 ...