当前位置:网站首页>docker MySQL解决时区问题
docker MySQL解决时区问题
2022-07-06 09:05:00 【向涛歌学习】
前言
MySQL中插入数据的当前时间少了8个小时,在网上查资料得知是没有设置时区,使用的系统时区。

通过命令
show variables like "%time_zone%"
可以查看时区:
更改配置文件my.cnf:
[mysqld]
default-time-zone='+08:00'
然后重启MySQL,再查看time_zone:
附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/ #映射mysql的数据目录到宿主机,保存数据
- /root/jzt/docker/mysql/conf/my.cnf:/etc/mysql/my.cnf #把mysql的配置文件映射到容器的相应目录
- /root/jzt/docker/mysql/logs:/logs
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: xxx
# 初始化用户(不能是root 会报错, 后续需要给新用户赋予权限)
MYSQL_USER: xxx
# 用户密码
MYSQL_PASSWORD: xxx
边栏推荐
- 【深度学习】语义分割-源代码汇总
- Mapreduce实例(五):二次排序
- max-flow min-cut
- Contrôle de l'exécution du module d'essai par panneau dans Canoe (primaire)
- Hero League rotation map automatic rotation
- What you have to know about network IO model
- Constants and pointers
- Day 5 of MySQL learning
- The real future of hardware engineers may not be believed by you if I say so
- Leetcode:608 tree node
猜你喜欢

Automation sequences of canoe simulation functions

Oom happened. Do you know the reason and how to solve it?
![[CV] target detection: derivation of common terms and map evaluation indicators](/img/e8/04cc8336223c0ab2dea5638def88df.jpg)
[CV] target detection: derivation of common terms and map evaluation indicators

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

CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
![[deep learning] semantic segmentation: paper reading: (2021-12) mask2former](/img/dd/fe2bfa3563cf478afe431ac87a8cb7.png)
[deep learning] semantic segmentation: paper reading: (2021-12) mask2former
![[deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need](/img/84/cfcd006d445fc54ea0eda3f92e7d9d.jpg)
[deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need

单片机实现模块化编程:思维+实例+系统教程(实用程度令人发指)

Can I learn PLC at the age of 33

在CANoe中通过Panel面板控制Test Module 运行(初级)
随机推荐
Automation sequences of canoe simulation functions
Random notes
Keep these four requirements in mind when learning single chip microcomputer with zero foundation and avoid detours
Take you back to spark ecosystem!
竞赛vscode配置指南
MapReduce instance (VI): inverted index
The real future of hardware engineers may not be believed by you if I say so
Popularization of security knowledge - twelve moves to protect mobile phones from network attacks
C#/. Net phase VI 01C Foundation_ 01: running environment, process of creating new C program, strict case sensitivity, meaning of class library
max-flow min-cut
Several ways of MySQL database optimization (pen interview must ask)
Several silly built-in functions about relative path / absolute path operation in CAPL script
Why is 51+ assembly in college SCM class? Why not come directly to STM32
Control the operation of the test module through the panel in canoe (Advanced)
Solve the problem of too many small files
Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
I2C summary (single host and multi host)
Combined search /dfs solution - leetcode daily question - number of 1020 enclaves
C杂讲 文件 初讲
Nc29 search in two-dimensional array