当前位置:网站首页>一篇永久摆脱Mysql时区错误问题,idea数据库可视化插件配置
一篇永久摆脱Mysql时区错误问题,idea数据库可视化插件配置
2022-08-01 23:55:00 【风铃听雨~】
项目场景:
今天在做项目的时候遇到一个关于
mysql时区的问题,在这里汇总记录一下解决过程,希望可以帮助到有需要的人。
问题描述
在做项目的时候突然遇到以下的报错,可以看到是说
数据库的时区错误,这里使用的是Mysql 8.0.15数据库。
这里试用了idea提供的数据库可视化插件。
以下报错使得无法访问数据库。
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: 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.
### The error may exist in StudentMapper.xml
### The error may involve ll.getAll
### The error occurred while executing a query
### Cause: 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.
原因分析
这里首先考虑是数据库本身的默认时区设置的问题,
其次考虑在设置idea数据库可视化插件连接的时候的时区的设置问题
解决方案:
通过以下步骤解决了此问题:
打开命令窗口,进入mysql服务:
接着查询时区:
show variables like "%time_zone%";

这里显示SYSTEM表示跟随系统,一般情况下是没有问题的,但是偶尔也会出现问题,这里我们就直接更改成'+8:00'
set global time_zone='+08:00';
注意:这只是临时修改,重启mysql服务后就会失效
下面介绍永久修改:
永久的修改:修改mysql的配置文件my.ini,添加:default-time-zone=’+08:00’,重启mysql生效,注意一定要在 [mysqld] 之下加 ,否则会出现 unknown variable ‘default-time-zone=+8:00’

接下来再去idea里面测试一下。
发现结果还是报错,那么据考虑是idea数据库可视化插件的链接配置问题。
接下来修改idea数据库可视化插件配置:


在这里加上时区’+8:00’,进行测试。完美解决。
总结
问题不大,但也着实头疼,一次性解决不很完美。
有帮助的小伙伴来个三连吧!!!
边栏推荐
- 使用Jenkins做持续集成,这个知识点必须要掌握
- Convert LocalDateTime to Date type
- 一款简洁的文件传输工具
- Use Jenkins for continuous integration, this knowledge point must be mastered
- Various Joins of Sql
- Zadig 面向开发者的自测联调子环境技术方案详解
- @Scheduled注解详解
- Secondary Vocational Network Security Competition B7 Competition Deployment Process
- background-image使用
- C language Qixi is coming!It's time to show the romance of programmers!
猜你喜欢

A brief analysis of mobile APP security testing in software testing, shared by a third-party software testing agency in Beijing

ES中SQL查询详解

【MySQL系列】 MySQL表的增删改查(进阶)

Leetcode 129求根节点到叶节点数字之和、104二叉树的最大深度、8字符串转换整数(atoi)、82删除排序链表中的重复元素II、204二分查找、94二叉树的中序遍历、144二叉树的前序遍历

分享一份接口测试项目(非常值得练手)

在CDH的hue上的oozie出现,提交 Coordinator My Schedule 时出错

The Spark of Sql join on the and and where

Data Organization --- Chapter 5 Trees and Binary Trees --- The Concept of Binary Trees --- Application Questions

Is TCP reliable?Why?

2022第六届强网杯部分wp
随机推荐
@WebServlet注解(Servlet注解)
@Resource和@Autowired的区别
Programmer is still short of objects? A new one is enough
获取小猪民宿(短租)数据
Data Organization --- Chapter 5 Trees and Binary Trees --- The Concept of Binary Trees --- Application Questions
What can be done to make this SQL into a dangerous SQL?
security 会话并发管理
numpy.around
nodejs--process
Deep Learning Fundamentals - Numpy-based Recurrent Neural Network (RNN) implementation and backpropagation training
ansible模块--copy模块
WEB安全基础 - - - XRAY使用
学习英语的网站与资料
【Leetcode】473. Matchsticks to Square
DOM 基础操作
The third chapter of the imitation cattle network project: develop the core functions of the community (detailed steps and ideas)
mysql8安装make报错如何解决
一款简洁的文件传输工具
2022 6th Strong Net Cup Part WP
SphereEx苗立尧:云原生架构下的Database Mesh研发实践