mysql 时区查看(MySQL时区设置总结--参数system)

 2024-12-08  阅读 162  评论 0

摘要:概述今天主要针对mysql时区这方面做一个总结,这里介绍两个参数:system_time_zone和time_zone。01全局参数system_time_zone系统时区,在MySQL启动时会检查当前系统的时区并根据系统时区设置全局参数system_time_zone的值。The system t
概述

今天主要针对mysql时区这方面做一个总结,这里介绍两个参数:system_time_zone和time_zone。


01全局参数system_time_zone

系统时区,在MySQL启动时会检查当前系统的时区并根据系统时区设置全局参数system_time_zone的值。

The system time zone. When the server starts, it attempts to determine the time zone of the host machine automatically and uses it to set thesystem_time_zone system variable. The value does not change thereafter.


02全局参数time_zone

用来设置每个连接会话的时区,默认为system时,使用全局参数system_time_zone的值。

The current time zone. This variable is used to initialize the time zone for each client that connects. By default, the initial value of this is 'SYSTEM' (which means, “use the value of system_time_zone”).


03参数log_timestamps

用于设置Error Log/Genaral Log/Slow Log这三种日志的时间信息。

有效值为UTC(默认)和SYSTEM(本地系统时区),当设置为system时,会使用参数system_time_zone的值。


04修改参数time_zone

# 启动命令 --default-time-zone=timezone # 配置文件 default-time-zone=timezone # 运行期间 set global time_zone=' 8:00';

mysql 时区查看(MySQL时区设置总结--参数system)(1)

mysql 时区查看(MySQL时区设置总结--参数system)(2)

查看操作系统时区

#使用date命令 date "%Z %z" date -R ## 使用timedatectl timedatectl|grep "Timezone" ## 查看文件 /etc/timezone cat /etc/timezone

mysql 时区查看(MySQL时区设置总结--参数system)(3)

ps:如果无法修改操作系统时区,又希望数据库使用其他时区,则可以使用参数time_zone来修改。


后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注一下~

mysql 时区查看(MySQL时区设置总结--参数system)(4)

,

版权声明:xxxxxxxxx;

原文链接:http://cn.tdroid.net/ce2e7Cz0EBA4BVFA.html

发表评论:

管理员

  • 内容265673
  • 积分0
  • 金币0
关于我们
lecms主程序为免费提供使用,使用者不得将本系统应用于任何形式的非法用途,由此产生的一切法律风险,需由使用者自行承担,与本站和开发者无关。一旦使用lecms,表示您即承认您已阅读、理解并同意受此条款的约束,并遵守所有相应法律和法规。
联系方式
电话:
地址:广东省中山市
Email:
注册登录
注册帐号
登录帐号

Copyright © 2022 太卓开发网 Inc. 保留所有权利。 泰达科技网易库网

页面耗时0.1037秒, 内存占用1.33 MB, 访问数据库18次