当前位置:网站首页>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
边栏推荐
- 【深度学习】语义分割:论文阅读:(CVPR 2022) MPViT(CNN+Transformer):用于密集预测的多路径视觉Transformer
- Day 5 of MySQL learning
- C杂讲 文件 续讲
- Several silly built-in functions about relative path / absolute path operation in CAPL script
- Scoped in webrtc_ refptr
- 五月集训总结——来自阿光
- 33岁可以学PLC吗
- cmooc互联网+教育
- MapReduce instance (V): secondary sorting
- Regular expressions are actually very simple
猜你喜欢

Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]

Combined search /dfs solution - leetcode daily question - number of 1020 enclaves

Hero League rotation chart manual rotation

C杂讲 动态链表操作 再讲

嵌入式開發中的防禦性C語言編程

CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?

Elk project monitoring platform deployment + deployment of detailed use (II)

宝塔的安装和flask项目部署

大学想要选择学习自动化专业,可以看什么书去提前了解?

Control the operation of the test module through the panel in canoe (Advanced)
随机推荐
What are the models of data modeling
History of object recognition
嵌入式开发中的防御性C语言编程
Can I learn PLC at the age of 33
How does the single chip microcomputer execute the main function from power on reset?
机械工程师和电气工程师方向哪个前景比较好?
西南大学:胡航-关于学习行为和学习效果分析
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
C杂讲 双向循环链表
Yarn organizational structure
51单片机进修的一些感悟
一大波开源小抄来袭
Delayed note learning
max-flow min-cut
I2C summary (single host and multi host)
Single chip microcomputer realizes modular programming: Thinking + example + system tutorial (the degree of practicality is appalling)
Regular expressions are actually very simple
Solve the problem of too many small files
CANoe CAPL文件操作目录合集
Canoe cannot automatically identify serial port number? Then encapsulate a DLL so that it must work