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
When I was helping someone adjust the code today,...
I typed a wrong mysql command and want to cancel ...
Preface During the development process, you will ...
1. Document flow and floating 1. What is document...
Any number of statements can be encapsulated thro...
Uninstall tomcat9 1. Since the installation of To...
Table of contents Web Components customElements O...
Table of contents 1. What is a closure? 1.2 Memoi...
Table of contents 1. Prototype 2. Prototype chain...
Table of contents 1. Implementation process 2. Di...
React is a JavaScript library for building user i...
Ubuntu 18.04 installs mysql 5.7 for your referenc...
Using the UNION Operator union : Used to connect ...
Preface: MySQL master-slave architecture should b...
1. Introduction to Macvlan Before the emergence o...