2022.03.28 TIL

Yeon Jeffrey Seo·2022년 3월 28일
0

mysql 시간대 변경

AWS EC2와 같이 인스턴스를 대여해서 사용하는 경우 그 위치에 따라 시간대가 다를 수 있다.
DB를 보고 데이터를 추적해야 하는 상황에서 시간대가 안 맞아 좀 곤란한 상황이 생길 수 있어 미리 시간대를 바꿔보았다.

현재 mysql 설정 확인

# MySQL 접속
sudo /usr/bin/mysql -u root -p
select @@global.time_zone;

SYSTEM으로 되어 있다면 OS 시간대를 따라가겠다는 것.
conf 파일에 한 줄을 추가해서 간단하게 시간대 변경 가능

sudo vim /etc/mysql/mysql.conf.d/mysql.cnf

파일 가장 아래에 다음 한 줄을 추가해준다.

default-time-zone="+09:00"

mysql 재시작(ubuntu 18.04)

sudo systemctl restart mysql

참고자료

https://study-ce.tistory.com/59

profile
The best time to plant a tree was twenty years ago. The second best time is now.

0개의 댓글

관련 채용 정보

Powered by GraphCDN, the GraphQL CDN