docker mysql时间与系统时间不一致
centos校准时间,安装ntp服务器
yum install ntp
docker mysql时间与系统时间不一致
方法一:创建容器时设置
-v /etc/localtime:/etc/localtime -v /etc/timezone:/etc/timezone
docker run -p 3306:3306 --name mysql -v /etc/localtime:/etc/localtime -v /etc/timezone:/etc/timezone -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=密码 -d mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
方法二:修改容器配置
docker exec mysql date
docker cp /usr/share/zoneinfo/Asia/Shanghai mysql:/etc/localtime
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!