使用spring boot整合MySQL时一直报

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

报错信息

系统时区的错误

查看mysql时区

show VARIABLES like "%time_zone%"

解决方法:

  1.在原来的参数“url”后面,拼上这个字符串:?serverTimezone=GMT%2B8,

    如:jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8

      东八区的表示:

        GMT%2B8,GMT+8,北京时间东八区

        Asia/Shangha,上海时间

      为何没有asia/beijing时区?

  2.设置mysql的时区

    MySQL默认的时区是UTC时区

    (1)永久的修改:修改mysql的配置文件,添加:default-time-zone='+08:00',重启mysql生效

(2)临时的修改:执行mysql命令 set global time_zone='+08:00',立即生效,重启mysql后失效

  

    

    

解决java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone的更多相关文章

  1. 吴裕雄--天生自然 JAVA开发学习:解决java.sql.SQLException: The server time zone value报错

    这个异常是时区的错误,因此只你需要设置为你当前系统时区即可,解决方案如下: import java.sql.Connection ; import java.sql.DriverManager ; i ...

  2. 解决mysql java.sql.SQLException: The server time zone value‘XXXXXX' is unrecognized or represents...

    解决 java.sql.SQLException: The server time zone value 'XXXXXX' is unrecognized or represents more tha ...

  3. 连接mysql数据库报错java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized...解决方法

    今天连接mysql数据库报错如下: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or r ...

  4. 连接mysql报错java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized...解决方法

    报错内容: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents mo ...

  5. java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ 解决方案

    //第一个异常 Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysq ...

  6. JDBC连接数据库报错:java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. ......

    问题:Java程序使用JDBC连接MySQL数据库时,控制台报错如下: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' ...

  7. Exception in thread “main” java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time zone.

    Exception in thread “main” java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ is unrecogn ...

  8. 【MySQL】java.sql.SQLException: The server time zone value

    错误:Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: The se ...

  9. java.sql.SQLException: 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 server

    错误信息 java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents ...

随机推荐

  1. shutdown vs close

    shutdown 和 close关闭tcp连接的介绍网上有很多,主要区别如下: 1.调用close后,将中止通信.删除套接字.丢弃数据.但是,注意喽,但是,如果有多个进程共享一个套接字,close每被 ...

  2. aps.net手写验证模型的方法

    /// <summary> /// 基础验证类 /// </summary> public class BaseValidator { /// <summary> ...

  3. Java项目收藏

    数据库 MyCat:数据库中间件 IM.消息推送 t-io:不仅仅是百万级即时通讯框架 tio-im:基于t-io写的IM,主要目标降低即时通讯门槛,实现多端不同协议间的消息发送如http.webso ...

  4. Knockout.Js官网学习(options绑定)

    前言 options绑定控制什么样的options在drop-down列表里(例如:<select>)或者 multi-select 列表里 (例如:<select size='6' ...

  5. Linux性能分析流程图

  6. Excel分组快速自动填充编号

    在Excel自动填充很简单,但如果按分组等条件进行填充就有点麻烦了 说麻烦可能是你并没有搞清楚到底如何才能实现你的需求   下图是客户提供的Excel数据,我需要将下面的数据导入到数据库中,因为客户在 ...

  7. centos清除dns cache.

    # /etc/init.d/nscd restart # service nscd restart # service nscd reload # nscd -i hosts https://www. ...

  8. JavaScript – Convert Image to Base64 String

    From: https://bytenota.com/javascript-convert-image-to-base64-string/ his post shows you two approac ...

  9. 高并发 Web 服务的演变:节约系统内存和 CPU

    本文内容 越来越多的并发连接数 Web 前端优化,降低服务端压力 节约 Web 服务端的内存 节约 Web 服务器的 CPU 小结 一,越来越多的并发连接数 现在,Web 系统面对的并发连接数呈现指数 ...

  10. Spark机器学习(5):SVM算法

    1. SVM基本知识 SVM(Support Vector Machine)是一个类分类器,能够将不同类的样本在样本空间中进行分隔,分隔使用的面叫做分隔超平面. 比如对于二维样本,分布在二维平面上,此 ...