当前位置:网站首页>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
- 华南技术栈CNN+Bilstm+Attention
- [deep learning] semantic segmentation - source code summary
- Several ways of MySQL database optimization (pen interview must ask)
- PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
- Processes of libuv
- 单片机如何从上电复位执行到main函数?
- MapReduce instance (V): secondary sorting
- Download address of canoe, download and activation of can demo 16, and appendix of all canoe software versions
- Take you back to spark ecosystem!
猜你喜欢
[flask] crud addition and query operation of data
tn-c为何不可用2p断路器?
33岁可以学PLC吗
MapReduce working mechanism
Why can't TN-C use 2p circuit breaker?
Selection of software load balancing and hardware load balancing
Regular expressions are actually very simple
机械工程师和电气工程师方向哪个前景比较好?
Hero League rotation chart manual rotation
Take you back to spark ecosystem!
随机推荐
VH6501学习系列文章
Day 5 of MySQL learning
通过bat脚本配置系统环境变量
Webrtc blog reference:
History of object recognition
[deep learning] semantic segmentation - source code summary
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
嵌入式开发比单片机要难很多?谈谈单片机和嵌入式开发设计经历
发生OOM了,你知道是什么原因吗,又该怎么解决呢?
Une grande vague d'attaques à la source ouverte
max-flow min-cut
MapReduce instance (VIII): Map end join
[flask] crud addition and query operation of data
Take you back to spark ecosystem!
[untitled]
I2C summary (single host and multi host)
嵌入式中的合作开发--函数指针
C#/. Net phase VI 01C Foundation_ 01: running environment, process of creating new C program, strict case sensitivity, meaning of class library
宝塔的安装和flask项目部署
Counter attack of noodles: redis asked 52 questions in a series, with detailed pictures and pictures. Now the interview is stable