2015년 11월 25일 수요일

MySQL TimeZone Configuration

MySQL Time Zone.

1. 3 Level Time Zone. 

MySQL support 3 level time zone setting.

1). System Time Zone. 

System time zone is the highest level time zone. You can see system_time_zone system variable. If you don't setting anything, When the server starts, it attempts to determine the time zone of the machine.

When MySQL startup with the --timezone=XXX option to mysqld_safe, You can set system_time_zone variable. And, you can set system_time_zone system variable by setting the TZ environment variable.

2). Server Time Zone.

It means MySQL server's current time zone. System variables is time_zone. If system_time_zone doesn't set, the initial value of time_zone is SYSTEM.

You can set the global value of time_zone with --default-time-zone=XXX option to mysqld_safe. Or, You can write the following line in an option file

[mysqld]
default-time-zone='XXX'

You can set the global value of time_zone at runtime with this statement:

mysql> set global time_zone= XXX;

3). Connection Time Zone. 

Each client has its own time zone setting with this statement:

mysql> set time_zone = XXX; 

2. Configuration of Timezone. 

Value of Timezone can be given  several formats.

1) SYSTEM 

It means the time zone should be the same as the system's.

2) Offset from UTC 

such as '+00:00' , '+10:00' or '-6:00'

3) Named time zone 

such as 'Asia/Seoul' , 'US/Eastern' or 'Europe/Paris'
You must loading named time zone data in mysql schema.




댓글 없음:

댓글 쓰기