首页 » 网站推广 » phpmysql设置时区技巧_想学mysql时区设置看这篇就够了

phpmysql设置时区技巧_想学mysql时区设置看这篇就够了

访客 2024-12-11 0

扫一扫用手机浏览

文章目录 [+]

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的值。

phpmysql设置时区技巧_想学mysql时区设置看这篇就够了

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”).

phpmysql设置时区技巧_想学mysql时区设置看这篇就够了
(图片来自网络侵删)
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';

查看操作系统时区

#利用date命令date +\"大众%Z %z\"大众date -R## 利用timedatectltimedatectl|grep \"大众Timezone\公众## 查看文件 /etc/timezonecat /etc/timezone

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

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

标签:

相关文章