当前位置:网站首页>Docker MySQL solves time zone problems
Docker MySQL solves time zone problems
2022-07-06 09:56:00 【Learn from Tao Ge】
Preface
MySQL The current time for inserting data in is less 8 Hours , Check the information on the Internet and know that there is no time zone , The system time zone used .

Through the command
show variables like "%time_zone%"
You can view the time zone :
Changing configuration files my.cnf:
[mysqld]
default-time-zone='+08:00'
And then restart MySQL, Check it again time_zone:
attach docker-compose.yml:
my_mysql:
image: mysql:8.0
container_name: my_mysql
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1
restart: always
volumes:
- /root/jzt/docker/mysql/data:/var/lib/mysql/ # mapping mysql Data directory of to host machine , Save the data
- /root/jzt/docker/mysql/conf/my.cnf:/etc/mysql/my.cnf # hold mysql The configuration file of is mapped to the corresponding directory of the container
- /root/jzt/docker/mysql/logs:/logs
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: xxx
# Initialize user ( It can't be root Will report a mistake , You need to grant permissions to new users later )
MYSQL_USER: xxx
# User password
MYSQL_PASSWORD: xxx
边栏推荐
- Configure system environment variables through bat script
- 四川云教和双师模式
- Webrtc blog reference:
- 五月刷题01——数组
- What are the models of data modeling
- CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
- How does the single chip microcomputer execute the main function from power on reset?
- A new understanding of RMAN retention policy recovery window
- cmooc互联网+教育
- Compress decompress
猜你喜欢

发生OOM了,你知道是什么原因吗,又该怎么解决呢?

The replay block of canoe still needs to be combined with CAPL script to make it clear

Which is the better prospect for mechanical engineer or Electrical Engineer?

51单片机进修的一些感悟

Contrôle de l'exécution du module d'essai par panneau dans Canoe (primaire)

Contest3145 - the 37th game of 2021 freshman individual training match_ B: Password

【深度学习】语义分割-源代码汇总

Hard core! One configuration center for 8 classes!

If a university wants to choose to study automation, what books can it read in advance?

Summary of May training - from a Guang
随机推荐
Zsh configuration file
Function description of shell command parser
Une grande vague d'attaques à la source ouverte
五月刷题27——图
Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Why can't TN-C use 2p circuit breaker?
What are the models of data modeling
How does the single chip microcomputer execute the main function from power on reset?
MapReduce instance (VIII): Map end join
Hard core! One configuration center for 8 classes!
学习单片机对社会的帮助是很大的
Inject common SQL statement collation
17 医疗挂号系统_【微信支付】
Hero League rotation map automatic rotation
硬件工程师的真实前途我说出来可能你们不信
【深度学习】语义分割:论文阅读:(CVPR 2022) MPViT(CNN+Transformer):用于密集预测的多路径视觉Transformer
Canoe cannot automatically identify serial port number? Then encapsulate a DLL so that it must work
CANoe CAPL文件操作目录合集
华南技术栈CNN+Bilstm+Attention
Compress decompress