MySQL Time Zone(표준시간대) 설정 (UTC to Asia/Seoul)

ASHAPPYASIKNOW·2021년 10월 16일
0

Docker

목록 보기
5/7
post-thumbnail

MySQL Time Zone 확인

select @@global.time_zone, @@session.time_zone;

MySQL의 기본 설정은 시스템(SYSTEM)과 일치하게 설정 된 것을 확인 할 수 있다.


System Time Zone 확인

MySQL Dockder bash 접속

$ docker exec -i -t mysql_23306 /bin/bash
root@baf686406e49:/#

date로 timezone 확인하기

root@baf686406e49:/# date
Sat Oct 16 08:42:42 UTC 2021

Symbolic link로 timezone 확인하기

root@baf686406e49:/# ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Sep 27 00:00 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC


Asia/Seoul 로 변경

rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

date로 timezone 확인하기

root@baf686406e49:/# date
Sat Oct 16 22:30:13 KST 2021

Docker를 다시 시작해도 KST가 유지되는 것을 확인 할 수 있다.

profile
36.9 It's good time to start something new

0개의 댓글