Recently, when I installed MySQL in Docker, I found that the database time was 8 hours different from the system time. Linux server time: Enter mysql and enter date as follows It turns out that the two time zones are different. Because the MySQL container is installed in Docker, the incorrect MySQL time should be caused by the host Docker. After searching the data, I found that the default time zone of Docker is zone 0. In fact, this will cause a lot of trouble to the installed container, such as inaccurate execution log records. There are two solutions: Method 1: Copy the localtime of the host
Note: Due to time zone issues, the above command may report the following error
View this file It was found that this file referenced an address Solution: Switch Command
Then restart the container
Method 2: Shared host localtime Specify startup parameters when creating a container and mount the localtime file into the container
The problem of inconsistent time zones between the two is solved. This is the end of this article about the inconsistency between mysql time and system time in docker. For more related docker time inconsistency content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the code for implementing six sieve styles using HTML grid layout
The project was tested these days, and the tester...
This article example shares the specific code of ...
1. Transition Transition property usage: transiti...
The following command is often used: chmod 777 文件...
background In order to support Docker containeriz...
I am writing a small program recently. Because th...
Table of contents 1. Environment variable $PATH: ...
This article example shares the specific code of ...
drop table Drop directly deletes table informatio...
This tutorial shares the installation tutorial of...
There is a project developed on Mac, and the pack...
Table of contents utils: Use in vue: explain: Ima...
The parent node of the parent node, for example, t...
The code looks like this: SELECT @i:=@i+1 rowNum,...
1. Find duplicate rows SELECT * FROM blog_user_re...