Docker

docker mysql Unknown or incorrect time zone : 'Asia/Seoul'

pepega 2021. 10. 22. 15:34

docker mysql에서 time_zone 설정 중

Unknown or incorrect time zone : 'Asia/Seoul'

오류가 나왔다.

 

 

docker mysql /bin/bash 접속 

root@05bcc7dfec1c:/# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Enter password:
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
root@05bcc7dfec1c:/# mysql_tzinfo_to_sql  /usr/share/zoneinfo/Asia/Seoul KST

START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('KST', @time_zone_id);
INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES
 (@time_zone_id, -2147483648, 0)
,(@time_zone_id, -1948782472, 1)
,(@time_zone_id, -1830414600, 2)
,(@time_zone_id, -767350800, 4)
,(@time_zone_id, -681210000, 3)
,(@time_zone_id, -672228000, 4)
,(@time_zone_id, -654771600, 3)
,(@time_zone_id, -640864800, 4)
,(@time_zone_id, -623408400, 3)
,(@time_zone_id, -609415200, 4)
,(@time_zone_id, -588848400, 3)
,(@time_zone_id, -577965600, 4)
,(@time_zone_id, -498128400, 1)
,(@time_zone_id, -462702600, 5)
,(@time_zone_id, -451733400, 1)
,(@time_zone_id, -429784200, 5)
,(@time_zone_id, -418296600, 1)
,(@time_zone_id, -399544200, 5)
,(@time_zone_id, -387451800, 1)
,(@time_zone_id, -368094600, 5)
,(@time_zone_id, -356002200, 1)
,(@time_zone_id, -336645000, 5)
,(@time_zone_id, -324552600, 1)
,(@time_zone_id, -305195400, 5)
,(@time_zone_id, -293103000, 1)
,(@time_zone_id, -264933000, 4)
,(@time_zone_id, 547578000, 3)
,(@time_zone_id, 560883600, 4)
,(@time_zone_id, 579027600, 3)
,(@time_zone_id, 592333200, 4)
;
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
 (@time_zone_id, 0, 30472, 0, 'LMT')
,(@time_zone_id, 1, 30600, 0, 'KST')
,(@time_zone_id, 2, 32400, 0, 'JST')
,(@time_zone_id, 3, 36000, 1, 'KDT')
,(@time_zone_id, 4, 32400, 0, 'KST')
,(@time_zone_id, 5, 34200, 1, 'KDT')
,(@time_zone_id, 6, 36000, 1, 'KDT')
;
COMMIT;

 

이제 다시 time_zone을 설정해준다.

mysql> set global time_zone='Asia/Seoul';

mysql> set time_zone='Asia/Seoul';
mysql> select @@global.time_zone, @@session.time_zone;

+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| Asia/Seoul         | Asia/Seoul          |
+--------------------+---------------------+
1 row in set (0.00 sec)

출처

https://hodubab.tistory.com/312

 

[에러] mySQL timeZone 한국 설정 (우분투 리눅스)

mysql 5.7 Ubuntu Linux 18 timezone 한국으로 설정 중 ERROR 1298(HY000) : Unknown or incorrect time zone : 'Asia/Seoul' 발생 아래의 코드를 한줄씩 실행 root@test ~# >  mysql_tzinfo_to_sql /usr/sha..

hodubab.tistory.com

https://jwkim96.tistory.com/23

 

[MySQL] mysql server timezone 한국으로 설정하기.

timezone이란? (넘어가실 분들은 여기클릭) <미국의 timezone> 한국은 표준시(대한민국 표준시 - KST)를 하나의 시간대(timezone)만 사용하지만 미국처럼 영토가 넓은 국가들은 timezone이 여러개 있습니다.

jwkim96.tistory.com