当前位置:网站首页>发现mariadb数据库时间晚了12个小时
发现mariadb数据库时间晚了12个小时
2022-06-30 02:51:00 【雅冰石】
一 问题描述
当前时间是2022年6月27日11:32,但是我在数据库里查当前时间却比现在晚了12个小时:
SELECT NOW();
2022-06-26 23:30:51
发现时区是美国时区(EDT),非中国时区:

二 排查思路
看下操作系统的时区是什么(执行date命令),如果操作系统的时区不对,那数据库里的时区也不会对。
需要修改下操作系统时区(请参考linux CST与EDT时区互转_雅冰石的博客-CSDN博客),然后重启下数据库。
若不想重启线上数据库,也可以通过执行命令:
SET global time_zone = '+8:00';
只是set命令仅对新建连接生效,不会改变已有连接的。
所以之前连接还是之前的时间,我建议最好是在晚上重启下数据库(不用set global,直接重启数据库就行)
边栏推荐
- [oiclass] chess piece
- High paid programmers & interview questions series 63: talk about the differences between sleep (), yield (), join (), and wait ()
- What kind of foreign exchange trading platform is regulated and safe?
- 2. 成功解决 BUG:Exception when publishing, ...[Failed to connect and initialize SSH connection...
- CMake教程系列-01-最小配置示例
- Entering Jiangsu writers and poets carmine Jasmine World Book Day
- How does native JS generate Jiugong lattice
- 微信小程序页面跳转以及参数传递
- Raki's notes on reading paper: neighborhood matching network for entity alignment
- 如何在 JupyterLab 中把 ipykernel 切换到不同的 conda 虚拟环境?
猜你喜欢

Intel-Hex , Motorola S-Record 格式详细解析

Playful palette: an interactive parametric color mixer for artists

Unity3d ugui force refresh of layout components

Three solutions to forced hibernation of corporate computers

Shenzhen CPDA Data Analyst Certification in July 2022

Time complexity analysis

Study diary: February 15, 2022

2.8 【 weight of complete binary tree 】

Unity timeline data binding

Steam elements hidden in science and Technology Education
随机推荐
How to prevent phishing emails? S/mime mail certificate
High paid programmers & interview questions series 63: talk about the differences between sleep (), yield (), join (), and wait ()
uniapp 地址转换经纬度
C language pivot_ Invalid argument error resolution for root
Pytorch学习(二)
Global and Chinese market of subscription revenue management software 2022-2028: Research Report on technology, participants, trends, market size and share
如何在 JupyterLab 中把 ipykernel 切换到不同的 conda 虚拟环境?
Intel-Hex , Motorola S-Record 格式详细解析
IDEA 远程调试 Remote JVM Debug
Unity3d ugui force refresh of layout components
Redis+AOP怎么自定义注解实现限流
RAII内存管理
CMake教程系列-04-编译相关函数
Jvxetable增加自定义按钮
【直播笔记0629】 并发编程二:锁
CMake教程系列-05-选项及变量
Matlab code running tutorial (how to run the downloaded code)
Multi card server usage
Three solutions to forced hibernation of corporate computers
Call collections Sort() method, compare two person objects (by age ratio first, and by name ratio for the same age), and pass lambda expression as a parameter.