当前位置:网站首页>一篇永久摆脱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’,进行测试。完美解决。
总结
问题不大,但也着实头疼,一次性解决不很完美。
有帮助的小伙伴来个三连吧!!!
边栏推荐
- 【Leetcode】2360. Longest Cycle in a Graph
- 使用Jenkins做持续集成,这个知识点必须要掌握
- numpy.hstack
- Docker实践经验:Docker 上部署 mysql8 主从复制
- cdh6 opens oozieWeb page, Oozie web console is disabled.
- Excel文件读写(创建与解析)
- 20220725 Information update
- Flink学习第五天——Flink可视化控制台依赖配置和界面介绍
- Appears in oozie on CDH's hue, error submitting Coordinator My Schedule
- Programmer is still short of objects? A new one is enough
猜你喜欢

Sql之各种Join

WEB安全基础 - - - XRAY使用

检查 Oracle 版本的 7 种方法

background-image使用

ICLR 2022最佳论文:基于对比消歧的偏标签学习

cdh6打开oozieWeb页面,Oozie web console is disabled.

CDH6的Hue打开出现‘ascii‘ codec can‘t encode characters

How to get the best power efficiency in Windows 11?

经典文献阅读之--DLO

Work for 5 years, test case design is bad?To look at the big case design summary
随机推荐
Spark Sql之join on and和where
Excel表格数据导入MySQL数据库
Win11如何获得最佳电源效率?
经典文献阅读之--DLO
security 会话并发管理
类型“FC<Props>”的参数不能赋给类型“ForwardRefRenderFunction<unknown, Props>”的参数。 属性“defaultProps”的类型不兼容。 不
分享一份接口测试项目(非常值得练手)
ELK log collection
一个有些意思的项目--文件夹对比工具(一)
Loading configuration of Nacos configuration center
洞见云原生微服务及微服务架构浅析
Use Jenkins for continuous integration, this knowledge point must be mastered
solidity
【MySQL系列】MySQL数据库基础
【Leetcode】473. Matchsticks to Square
[LeetCode304 Weekly Competition] Two questions about the base ring tree 6134. Find the closest node to the given two nodes, 6135. The longest cycle in the graph
Excel文件读写(创建与解析)
【图像融合】基于加权和金字塔实现图像融合附matlab代码
GetHashCode与Equals
[Three sons] C language implements simple three sons