异常信息:Exception in thread “main” java.lang.RuntimeException: 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 ‘serverTimezone’ configuration property) to use a more specifc time zone value if you want to utilize time zone support.

异常原因:这是因为使用的mysql时区不同,修改为本地时区即可

解决方法一:在代码中更改时区,但这样做治标不治本,每次写代码都要加上去

在代码URL后面加入: ?serverTimezone=GMT%2B8

如:“jdbc:mysql://localhost:3306/mydb?serverTimezone=GMT%2B8”

解决方法二:直接对数据库时区进行修改,这样做还是治标不治本,重启电脑或者服务器后还是会恢复原状

win + R ------》输入cmd

输入mysql账号和密码(其中root为用户名,123456为密码,可根据实际情况填)

mysql -uroot -p123456

查看现在的时区

show variables like ‘%time_zone%’;

修改为本地时区(以中国时区为例:需要在原时区上+8:00)

set global time_zone = ‘+8:00’;

修改成功,若需查看,需关闭命令(cmd)窗口再打开重新查看

解决方法三:直接对MySQL配置文件my.ini文件进行修改,一劳永逸!!!


default-time-zone=’+08:00’

至此,这个问题已完全解决

解决:java.sql.SQLException: The server time zone value xxxxx is unrecognized or represents more tha相关推荐

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

    报错截图: 中文意思: 无法获取JDBC连接; 嵌套异常是java.sql.SQLException:服务器时区值'???' 无法识别或代表多个时区.如果要使用时区支持,则必须配置服务器或JDBC驱动 ...

  2. 解决 java.sql.SQLException:The server time zone value xxx is unrecognized 问题

    报错问题:Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.j ...

  3. 连接MySql出现异常解决:java.sql.SQLException: The server time zone value is unrecognized or represents。

    QUESTION: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represent ...

  4. java.sql.SQLException: The server time zone value‘xxxxxxxx‘ is unrecognized

    报错笔记 原因 一.org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with ...

  5. SQLException: The server time zone value ‘EDT‘ is unrecognized or represents more than one time zone

    异常:java.sql.SQLException: The server time zone value 'EDT' is unrecognized or represents more than o ...

  6. java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents 解决方法

    转载自https://blog.csdn.net/weixin_37577564/article/details/80329775 在JDBC使用的时候有时候会出现java.sql.SQLExcept ...

  7. JDBC编程可能遇到的错误:java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or ..

    文章目录 1.错误提示: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 2.提示:Loading class com.mysql.jd ...

  8. java.sql.SQLException: The server time zone value �й���׼ʱ�� is unrecognized or represents ...

    使用springboot 整合mybatis项目启动控制台报错: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is un ...

  9. java.sql.SQLException: The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represent.........

     springboot整合mybatis时运行异常: java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecogn ...

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

    java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ 解决方案 参考文章: (1)java.sql.SQLException: ...

最新文章

  1. 计算机图形学 区域填充,计算机图形学 区域填充算法的实现
  2. matplotlib里的fig和ax的区别。
  3. Android RecyclerView实现横向滚动
  4. 使用微软分布式缓存服务Velocity Part 3
  5. 【20171025早】alert(1) to win 练习
  6. 01 Python变量和数据类型
  7. 前端学习(3088):vue+element今日头条管理-关于接口的使用(有声版)
  8. 如何在GPU上产生随机数
  9. Spring Boot 学习之配置文件 application.yml
  10. No goals have been specified for this build. You must specify a valid lifecycle phase or a goal.....
  11. Python强化训练笔记(二)——元组元素的命名
  12. 计算机网络中传输层传送的是什么,传输层
  13. [转] 心态是最大的本钱;人无完人,重要的是怎么做人
  14. java读写二进制文件 移动指针 seek_文件与文件夹操作
  15. gpgpu学习推荐书籍
  16. spark-sql总结
  17. 京东智臻链首推电子营业执照区块链应用场景落地!
  18. 前端(微信小程序为例)
  19. 基于java swing的学生学籍管理系统
  20. bpmn定义之过程自动化

热门文章

  1. PKUWC2019 总结
  2. 最强大脑记忆曲线(3)——设计页面
  3. redis源码浅见之sds
  4. 课程设计:波形发生器
  5. 中国银联Apple Pay 支付集成
  6. 内存测试软件 ddr4,DDR4内存芯片测试工具;DDR4内存检测仪
  7. 鼠标失灵,但鼠标和USB接口都是好的的情况。
  8. 支付宝手机网站支付接口集成的经验小结
  9. php手机网页唤醒支付宝APP支付,支付宝H5唤醒APP
  10. 百度招聘Android客服端(1)