MySQL Config--パラメータsystem_time_zoneとパラメータtime_zone

2879 ワード

グローバルパラメータ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 the system_time_zone  system variable. The value does not change thereafter.
 
グローバルパラメータ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”).
 
パラメータlog_timestampsは、Error Log/General Log/Slow Logの3つのログの時間情報を設定するために使用されます.有効な値はUTC(デフォルト)とSYSTEM(ローカルシステムタイムゾーン)で、systemに設定するとパラメータsystem_が使用されます.time_zoneの値.
 
パラメータtime_の変更zone
#     
--default-time-zone=timezone
#     
default-time-zone=timezone
#     
set global time_zone = timezone

set global time_zone='+8:00'
set global time_zone='Asia/Shanghai'

 
OSタイムゾーンの表示
##   date  
date +"%Z %z"
date -R


##   timedatectl
timedatectl|grep "Timezone"


##      /etc/timezone
cat /etc/timezone

 
オペレーティングシステムのタイムゾーンを変更できず、データベースで他のタイムゾーンを使用する場合は、パラメータtime_を使用します.zoneが修正します.
転載先:https://www.cnblogs.com/gaogao67/p/10686515.html