报错:The server time zone value ‘�й���׼ʱ��’ is unrecognied

当我们通过JDBC连接数据库的时候有时候会报出以下的错误:

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 specific time zone value if you want to utilize time zone support.

翻译一下就是:服务器时区值’�й���׼ʱ��’ 无法识别或表示多个时区。如果要使用时区支持,必须配置服务器或JDBC驱动程序(通过“serverTimezone”配置属性)以使用更具体的时区值。

这是由于使用的JDBC驱动包版本高于6(包括6),当我们使用这些版本连接要使用的URL时,必须加上serverTimezone参数,来设置时区。

解决方法1

将JDBC连接的URL修改为:

jdbc:mysql://localhost:3306/数据库名?serverTimezone=UTC

这里UTC代表全球标准时间,可以根据需要更改其值。

我们使用的时间是北京时间,即东八区时间,领先UTC八个小时。

所以我们可以将URL修改为:

jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2b8
//上海时区也为东八区
jdbc:mysql://localhost:3306/数据库名?serverTimezone=Asia/Shanghai

解决方法2

当然我们可以直接通过更改使用的驱动包版本来解决该问题,只要使用6以下的版本就能解决。

报错:The server time zone value ‘�й���׼ʱ��‘ is unrecognied相关推荐

  1. 解决Hibernate报错The server time zone value is unrecognized or represents more than one time zone

    解决Hibernate报错The server time zone value is unrecognized or represents more than one time zone   笔者在使 ...

  2. 数据库连接报错:The server time zone value '�й���׼ʱ��' is unrecognized

    最近使用maven框架学习原生JDBC时遇到了如下错误: Exception in thread "main" java.sql.SQLException: The server ...

  3. 记一次连接数据库报错The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zo

    今天在使用mybatis连接数据库时报了如下错误: The server time zone value '�й���׼ʱ��' is unrecognized or represents more ...

  4. mysql报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zo

    练习C3P0连接mysql时报错: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than ...

  5. springboot 连接MySQL的时候报错The server time zone value ‘Öйú±ê׼ʱ¼ä‘ is unrec

    出现这个报错的是因为mysql的时区问题 url: jdbc:mysql://localhost:3306/orderingsystem?useUnicode=true&characterEn ...

  6. ideal连接数据库报错The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time

    在jdbc连接的url后面加上serverTimezone=GMT 即 jdbc:mysql://localhost:3306/数据库名?serverTimezone=GMT

  7. 启动mysql服务是报错找不到pid_mysql报错 The server quit without updating PID file

    我的mysql总是在重启的时候mysql的数据总是会初始化,我以为是的配置问题,所以在网上找了各种方法测试都不通过,下面看我遇到的几个错误. 重启mysql失败 [root@wulaoer_mysql ...

  8. 【Flink】Flink 写入 kafka 报错 The server disconnected before a response was received

    文章目录 1.场景再现 1.1.概述 1.场景再现 1.1.概述 Flink 写入 kafka 报错 The server disconnected before a response was rec ...

  9. php7链接数据库报错The server requested authentication method unknown to the client

    php7链接数据库报错The server requested authentication method unknown to the client 主要原因 是因为 mysql 8.0 升级了密码 ...

最新文章

  1. 带您走进七周七语言的程序世界
  2. pku1182(食物链) hdu3047 Zjnu Stadium
  3. MATLAB实用知识,如何对函数的输入进行检查和解析?
  4. Homestead 使用总结
  5. NSArray打印汉字的方法
  6. beanpostprocessor与@autowired的关系
  7. 秦磊:被分众CEO“忽悠”往事
  8. SQL-33 创建一个actor表,包含如下列信息
  9. 关于flink的setCommitOffsetsOnCheckpoints
  10. 最大频偏和最大相位偏移_振荡器的相位噪声模型
  11. Tensorflow Python3 做神经网络(视频教程)
  12. linux csi 摄像头,A20 linux(dragonboard)同时使用Parallel CSI Camera及UVC
  13. 计算机盘中文件夹丢失,电脑装机后原区分f盘内文件夹丢失如何找回
  14. Access2016学习5
  15. 人工智能的利弊?好处和危害都有哪些
  16. Navicat Premium 导入SQL文件
  17. 习题课3-1(动态规划)
  18. 计算机无法删除用户,怎么彻底删除一个用户
  19. KubeEdge SIG AI 进展与规划
  20. 计算机网络具备哪些要素,一个计算机网络必须具备以下3个基本要素

热门文章

  1. Android Studio安装遇到的问题(最全)
  2. HTK语音识别工具包的安装和编译
  3. 回溯法(算法分析与设计)
  4. 软件测试(网页,脚本)入门
  5. 二叉树的先序遍历(源代码)
  6. Java 全限定类名和非限定类名有何区别
  7. 计算机网络密码凭据,网络访问: 不允许存储网络身份验证的密码和凭据
  8. Qt5.12.x 导入CMakeLists.txt 工程 提示 No suitable kits found.
  9. 零信任网络安全——软件定义边界SDP技术架构指南
  10. ubuntu20.04关闭内核自动更新