当前位置:网站首页>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
边栏推荐
猜你喜欢
I2C summary (single host and multi host)
Take you back to spark ecosystem!
Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
MapReduce instance (x): chainmapreduce
Segmentation sémantique de l'apprentissage profond - résumé du code source
五月集训总结——来自阿光
How can I take a shortcut to learn C language in college
Target detection -- yolov2 paper intensive reading
[CV] target detection: derivation of common terms and map evaluation indicators
Some thoughts on the study of 51 single chip microcomputer
随机推荐
There are software load balancing and hardware load balancing. Which one to choose?
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
Automation sequences of canoe simulation functions
Tianmu MVC audit II
Vh6501 Learning Series
一大波开源小抄来袭
Random notes
Processes of libuv
Hugo blog graphical writing tool -- QT practice
vscode 常用的指令
Nc29 search in two-dimensional array
Tianmu MVC audit I
嵌入式中的合作开发--函数指针
068. Find the insertion position -- binary search
Libuv thread
Contest3145 - the 37th game of 2021 freshman individual training match_ B: Password
硬件工程师的真实前途我说出来可能你们不信
嵌入式開發中的防禦性C語言編程
A wave of open source notebooks is coming
Learning SCM is of great help to society