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
https://jwkim96.tistory.com/23
'Docker' 카테고리의 다른 글
Docker로 프로젝트(Springboot), DB(Postgres), 캐시(Redis) 연동하기 (0) | 2022.07.15 |
---|---|
docker 삭제, docker reinstall, docker uninstall (0) | 2021.11.05 |
docker 이미지 생성, docker hub 업로드, docker springboot mysql 연동 (0) | 2021.10.22 |
Docker 설치 mysql 설치 및 실행하기 Ubuntu 18.04 (0) | 2021.10.22 |
docker tomcat HTTP 상태 404 – 찾을 수 없음 (0) | 2021.10.22 |