当前位置:网站首页>There is an 8 hour difference between the docker installation of mysql and the host.
There is an 8 hour difference between the docker installation of mysql and the host.
2022-08-04 04:19:00 【sea of sperm whales】
Recently, I used docker to build a mysql container. When I started it, I found that the date inside was eight hours different from the host machine. At first, I thought it was a time zone problem of mysql, but later I found out that it was a time problem in the docker container.
Enter the host and docker and use the date command to check:
This is due to:
The host uses the CST time zone, and CST should refer to (China Shanghai Time, East Eighth District Time)
The container uses the UTC time zone, and UTC should refer to (Coordinated Universal Time, standard time)
Solution:
Because I have already started the container, I use the method of copying from the host machine to the inside of the container. If you have not run the container, it is best to mount the time file when you create the container.
docker cp /usr/share/zoneinfo/Asia/Shanghai mysql:/etc/localtime
Restart:
docker restart mysql
Verify:
has been synced.
边栏推荐
- 网络工程师入门必懂华为认证体系,附系统学习路线分享
- 拿捏JVM性能优化(自己笔记版本)
- "Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"
- Introduction to the memory model of the JVM
- 怎么把elastic中的异常登录ip和日志自动导出或抓取到数据库中?
- 目标检测-中篇
- 复现20字符短域名绕过
- 技术解析|如何将 Pulsar 数据快速且无缝接入 Apache Doris
- MySQL query optimization and tuning
- 系统设计.如何设计一个秒杀系统(完整版 转)
猜你喜欢
转:管理是对可能性的热爱,管理者要有闯进未知的勇气
【机器学习】21天挑战赛学习笔记(一)
MySQL query optimization and tuning
The Shell function
马尔可夫链
Converts XML tags to TXT format (voc conversion for yolo convenient training)
企业直播风起:目睹聚焦产品,微赞拥抱生态
Eight guiding principles to help businesses achieve digital transformation success
【MD5】采用MD5+盐的加密方式完成注册用户和登录账号
TL431的基本特性以及振荡电路
随机推荐
sql语句查询String类型字段小于10的怎么查
FFmpeg —— 通过修改yuv,将视频转为黑白并输出(附源码)
张量篇-应用案例
10 Convolutional Neural Networks for Deep Learning 3
出现504怎么办?由于服务器更新导致的博客报504错误[详细记录]
深度学习——以CNN服装图像分类为例,探讨怎样评价神经网络模型
[Ryerson emotional speaking/singing audiovisual dataset (RAVDESS)]
drools from download to postman request success
Significant differences between Oracle and Postgresql in PLSQL transaction rollback
Senior PHP development case (1) : use MYSQL statement across the table query cannot export all records of the solution
Basic characteristics of TL431 and oscillator circuit
The video of machine learning to learn [update]
7-3 LVS+Keepalived Cluster Description and Deployment
如何动态添加script依赖的脚本
Converts XML tags to TXT format (voc conversion for yolo convenient training)
7-2 LVS+DR Overview and Deployment
Functions, recursion and simple dom operations
2.15 keil使用电脑端时间日期
Learn iframes and use them to solve cross-domain problems
"Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"