当前位置:网站首页>docker安装mysql与宿主机相差8小时的问题。
docker安装mysql与宿主机相差8小时的问题。
2022-08-04 04:08:00 【抹香鲸之海】
最近用docker做了一个mysql的容器,启动发现里面的日期跟宿主机差了八个小时,起初以为是mysql的时区问题,后来发现是docker容器里面的时间问题。
进入宿主机和docker 内部 使用 date命令查询一下:
这是由于:
宿主机采用了CST时区,CST应该是指(China Shanghai Time,东八区时间)
容器采用了UTC时区,UTC应该是指(Coordinated Universal Time,标准时间)
解决:
因为我已经把容器起起来了,所以采用从宿主机拷贝到容器内部的方式,如果你还没有run起来容器,最好制作容器的时候就把时间文件挂载上。
docker cp /usr/share/zoneinfo/Asia/Shanghai mysql:/etc/localtime
重启一下:
docker restart mysql
验证一下:

已经同步了。
边栏推荐
- How to automatically export or capture abnormal login ip and logs in elastic to the database?
- FPGA解析B码----连载3
- 如何简化现代电子采购的自动化?
- 十一种概率分布
- 学会iframe并用其解决跨域问题
- Significant differences between Oracle and Postgresql in PLSQL transaction rollback
- 4-way two-way HDMI integrated business high-definition video optical transceiver 8-way HDMI high-definition video optical transceiver
- FPGA parsing B code----serial 3
- 7-1 LVS+NAT 负载均衡群集,NAT模式部署
- FFmpeg —— 通过修改yuv,将视频转为黑白并输出(附源码)
猜你喜欢
随机推荐
帮助企业实现数字化转型成功的八项指导原则
"Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"
SVM介绍以及实战
元宇宙“吹鼓手”Unity:疯狂扩局,悬念犹存
初识Numpy
文件系统的简单操作
MRS: Alluxio的使用介绍
The general SQL injection flow (sample attached)
[Ryerson emotional speaking/singing audiovisual dataset (RAVDESS)]
Embedded database development programming MySQL (full)
Y86. Chapter iv Prometheus giant monitoring system and the actual combat, Prometheus storage (17)
哎,又跟HR在小群吵了一架!
FPGA解析B码----连载3
基于Qt的目录统计QDirStat
【观察】超聚变:首提“算网九阶”评估模型,共建开放繁荣的算力网络
2 Gigabit Optical + 6 Gigabit Electric Rail Type Managed Industrial Ethernet Switch Supports X-Ring Redundant Ring One-key Ring Switch
中信证券网上开户怎么开的?安全吗?
基地址:环境变量
深度学习之 10 卷积神经网络3
6-port full Gigabit Layer 2 network managed industrial Ethernet switch Gigabit 2 optical 4 electrical fiber self-healing ERPS ring network switch

![出现504怎么办?由于服务器更新导致的博客报504错误[详细记录]](/img/e0/32d78fac04dc2deb1cb1f847a7bab5.png)







