当前位置:网站首页>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
边栏推荐
- MapReduce instance (x): chainmapreduce
- 嵌入式開發中的防禦性C語言編程
- C杂讲 动态链表操作 再讲
- Take you back to spark ecosystem!
- 一大波开源小抄来袭
- Function description of shell command parser
- Counter attack of noodles: redis asked 52 questions in a series, with detailed pictures and pictures. Now the interview is stable
- CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
- 西南大学:胡航-关于学习行为和学习效果分析
- Une grande vague d'attaques à la source ouverte
猜你喜欢

cmooc互联网+教育

五月集训总结——来自阿光

MapReduce instance (V): secondary sorting

max-flow min-cut

Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide

CANoe不能自动识别串口号?那就封装个DLL让它必须行

Control the operation of the test module through the panel in canoe (primary)

History of object recognition

How can I take a shortcut to learn C language in college

CAPL script pair High level operation of INI configuration file
随机推荐
MapReduce instance (VI): inverted index
I2C summary (single host and multi host)
C杂讲 双向循环链表
Vh6501 Learning Series
CAPL script pair High level operation of INI configuration file
Safety notes
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
[untitled]
在CANoe中通過Panel面板控制Test Module 運行(初級)
Hero League rotation map automatic rotation
Several ways of MySQL database optimization (pen interview must ask)
[one click] it only takes 30s to build a blog with one click - QT graphical tool
一大波開源小抄來襲
A wave of open source notebooks is coming
AI的路线和资源
Listen to my advice and learn according to this embedded curriculum content and curriculum system
C杂讲 浅拷贝 与 深拷贝
[NLP] bert4vec: a sentence vector generation tool based on pre training
Leetcode:608 tree node
学习单片机对社会的帮助是很大的