当前位置:网站首页>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.
边栏推荐
猜你喜欢

For Qixi Festival, I made a confession envelope with code

技术解析|如何将 Pulsar 数据快速且无缝接入 Apache Doris

if,case,for,while

结构体函数练习

if,case,for,while

7-1 LVS+NAT 负载均衡群集,NAT模式部署

Basic characteristics of TL431 and oscillator circuit

Converts XML tags to TXT format (voc conversion for yolo convenient training)

Oracle与Postgresql在PLSQL内事务回滚的重大差异

See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business
随机推荐
new Date converts strings into date formats Compatible with IE, how ie8 converts strings into date formats through new Date, how to replace strings in js, and explain the replace() method in detail
【id类型和NSObject指针 ObjectIve-C中】
JVM Notes
Deep learning -- CNN clothing image classification, for example, discussed how to evaluate neural network model
Structure function exercise
【Ryerson情感说话/歌唱视听数据集(RAVDESS) 】
文件内容的操作
This Thursday evening at 19:00, the fourth live broadcast of knowledge empowerment丨The realization of equipment control of OpenHarmony smart home project
2022软件测试面试题 最新字节跳动50道真题面试题 刷完已拿下15k 附讲解+答疑
机器学习之视频学习【更新】
Shell 函数
SVM介绍以及实战
TL431的基本特性以及振荡电路
Postgresql source code (66) insert on conflict grammar introduction and kernel execution process analysis
JVM的内存模型简介
马尔可夫链
系统设计.秒杀系统
Mobile payment online and offline payment scenarios
Mini program + e-commerce, fun new retail
初识Numpy