【转载】在使用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; ...
随机推荐
- legend3---lamp.sh常用操作
legend3---lamp.sh常用操作 一.总结 一句话总结: 1.github上下载代码 2.修改项目数据库配置,修改文件权限等操作:chown -R apache:apache /data/w ...
- delphi 解决android 9上无法使用http协议
delphi 解决android 9上无法使用http协议 安卓9不让客户端通过非https方式访问服务端数据(不允许发送明文http请求)的问题. 解决方法: 1.选择安卓平台编译一次程序,在项目根 ...
- sql server management studio 连接时指定非默认端口 ,port
- 复习Android布局
效果如图: 这里没有做逻辑的处理,仅仅是布局的罗列.包括垂直和水平的线性布局,以及一个滚动的view. <?xml version="1.0" encoding=" ...
- 优雅编写Python3 的62个小贴士
iterable技巧 ▍1.创建一个数字序列(从0到10,间隔为2) >>> range(0,10,2)[0, 2, 4, 6, 8] ▍2.对一串数字求和(从0到10,间隔为2 ...
- Cisco设备自动定时备份配置
前言 当我们管理的网络设备为个位数的时候,手动的把配置通过tftp方式copy出来还是可以的.但是当我们管理几十台甚至上百台(有点夸张,都这个级别了肯定用专业的运维软件或者开发运维平台进行管理)的时候 ...
- 123457123456#0#-----com.threeapp.magicImageShow01----儿童宝宝魔法画笔
com.threeapp.magicImageShow01----儿童宝宝魔法画笔
- @Qualifier is not applicable for constructor
问题场景: 笔者在springboot项目中使用java_websocket作为客户端,调用第三方ws服务. 最初只调用一个ws服务,以下代码可以正常工作: @Bean public URI ttsU ...
- html5调整音频音高
var audioSrc = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1715/the_xx_-_intro.mp3'; function buff ...
- LeetCode_100. Same Tree
100. Same Tree Easy Given two binary trees, write a function to check if they are the same or not. T ...