JDBC driver连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than
出错原因:
因为安装mysql的时候时区设置的不正确。 mysql默认的是美国的时区,而我们中国大陆要比他们迟8小时,采用GMT+8:00格式。
也就是说是数据库和系统时区差异所造成的。
验证:运行cmd登录mysql,控制台输入:

show variables like '%time_zone%';
如果显示SYSTEM则是时区有问题,有两个解决方法:

解决方法一:
在jdbc连接的url后面加上serverTimezone=GMT即可解决问题,如果需要使用gmt+8时区,需要写成GMT%2B8。
1.1
按照网上的教程,我第一次是在数据库后面加上(没有引号):"?serverTimezone=GMT+8"

报错:java.sql.SQLException: No timezone mapping entry for 'GMT 8' ;
1.2
后来又查到,需要将+改成%2B,"?serverTimezone=GMT%2B8"就可以了:

1.3
有大神提到:如果把数据库时区改了,那么插入数据库的时间都会自动减8小时。(暂时还没有用到)
解决方案:比如是SpringBoot2.0,在jdbc配置上加了一个&serverTimezone=UTC就行了。
解决方法二:
修改MySQL的配置文件,MySQL配置文件是my.ini文件在你的安装目录下去找,我的是C:\web\mysql-8.0.13\my.ini
用记事本打开,在[mysqld]节点后面加上这句话:
default-time-zone='+08:00'

再次运行:
show variables like '%time_zone%';
显示+8:00就成功了:

此时不用在写?serverTimezone=GMT%2B8都可以运行成功。
JDBC driver连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than的更多相关文章
- 连接mysql报错 : The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone...
time zone 时区错误 DBEAVER连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or repres ...
- 解决MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents .....
1.前言 今天在用SpringBoot2.0+MyBatis+MySQL搭建项目开发环境的时候启动项目发现报了一个很奇怪的错,报错内容如下: java.sql.SQLException: The se ...
- 连接MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
MySQL time zone 时区错误 使用root用户登陆执行命令: ---> show variables like '%time_zone%'; 默认值system为美国时间:如下图: ...
- MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents
参考资料:https://blog.csdn.net/qq_37630354/article/details/82814330 在property里加上最后这个参数即可
- com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 问题解决方法
一.问题 今天用mybatis连接数据库时出现了如下错误: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The serve ...
- SpringBoot------连接MySQL报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
报错提示: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zon ...
- 解决报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
Cannot create PoolableConnectionFactory (The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized . ...
- 关于springboot 连接mysql 数据库报错问题
springboot连接MySQL运行报错: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more ...
- SpringBoot报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone
解决方法: 在数据库连接url配置后边加&serverTimezone=GMT%2B8 例: jdbc:mysql://127.0.0.1:3306/test改为jdbc:mysql://12 ...
随机推荐
- Keepalived原理与实战精讲--VRRP协议
. 前言 VRRP(Virtual Router Redundancy Protocol)协议是用于实现路由器冗余的协议,最新协议在RFC3768中定义,原来的定义RFC2338被废除,新协议相对还简 ...
- rds下载备份集在另外一台机器上恢复并应用binlog日志
-----------------------------备份还原并启动数据库----------------------------------1.创建目录,并把下载的压缩文件拷贝到相应的目录[ro ...
- dataguard从库数据库丢失恢复例子(模拟丢失数据文件)
准备工作,使用如下脚本进行数据库的全备份[oracle@localhost ~]$ more rman_backup.sh #!/bin/sh RMAN_OUTPUT_LOG=/home/oracle ...
- vue elementui报错总结
1. 错误: TypeError: _self.$scopedSlots.default is not a function 原因:这是因为在v-for/v-if切换标签时,原本这些标签每一个都是独 ...
- 剑指offer(5)用两个栈实现队列
题目描述 用两个栈来实现一个队列,完成队列的Push和Pop操作. 队列中的元素为int类型. 题目分析 栈是先进后出,队列是先进先出,因此两个栈,一个用来push,一个用来pop,同时注意下两个栈不 ...
- ( 转) Awesome Image Captioning
Awesome Image Captioning 2018-12-03 19:19:56 From: https://github.com/zhjohnchan/awesome-image-capti ...
- 深入分析Parquet列式存储格式【转】
Parquet是面向分析型业务的列式存储格式,由Twitter和Cloudera合作开发,2015年5月从Apache的孵化器里毕业成为Apache顶级项目,最新的版本是1.8.0. 列式存储 列式存 ...
- Codeforces 788 C. The Great Mixing
题目链接:http://codeforces.com/contest/788/problem/C 一看就不能暴力$DP$,我们可以将浓度的合并操看作为在追逐一高度,每次操作前这个高度都会向上走$n$, ...
- C# 虹软离线SDK引擎 人脸识别
一,背景 整体来说虹软的人脸识别SDK还是不错的.我们测试过Face++的,百度的,腾讯的,都是在线联网的,需要把上传数据到它们服务器,不利商业用途:虹软SDK支持离线. 二,下载虹软SDK 1.注册 ...
- 第三方API使用的好习惯
1自己封装API接口 有些不很稳定的API接口,最好还是自己封装隔离后再使用,否则哪天它一改接口,那我得到处替换了 比如融云的群组,聊天室