当前位置:网站首页>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/localtimeRestart:
docker restart mysqlVerify:

has been synced.
边栏推荐
- Basic characteristics of TL431 and oscillator circuit
- 基于 SSE 实现服务端消息主动推送解决方案
- Eight guiding principles to help businesses achieve digital transformation success
- unity框架之缓存池
- Structure function exercise
- 八年软件测试工程师带你了解-测试岗进阶之路
- 7-2 LVS+DR Overview and Deployment
- 转:管理是对可能性的热爱,管理者要有闯进未知的勇气
- 如何简化现代电子采购的自动化?
- Explain详解与实践
猜你喜欢
随机推荐
How class only static allocation and dynamic allocation
一文详解DHCP原理及配置
typescript type 和 interface 的区别
备份工具pg_dump的使用《postgres》
PHP高级开发案例(1):使用MYSQL语句跨表查询无法导出全部记录的解决方案
FFmpeg —— 录制麦克风声音(附源码)
八年软件测试工程师带你了解-测试岗进阶之路
网络工程师入门必懂华为认证体系,附系统学习路线分享
MRS: Introduction to the use of Alluxio
SQL interview Questions
劝退背后。
Based on the statistical QDirStat Qt directory
7.LVS负载均衡群集之原理叙述
42. 接雨水
用户与用户互发红包/支付宝C2C/B2C现金红包php源码示例/H5方式/兼容苹果/安卓
Use serve to build a local server
初识Numpy
6-port full Gigabit Layer 2 network managed industrial Ethernet switch Gigabit 2 optical 4 electrical fiber self-healing ERPS ring network switch
2022杭电多校联赛第五场 题解
2022支付宝C2C现金红包PHP源码DEMO/兼容苹果/安卓浏览器和扫码形式









