도커 Mysql init sql 한글 깨짐 현상 해결법

냥무룩·2023년 11월 22일
0

트러블슈팅

목록 보기
4/4

docker mysql container에서 init sql을 통해서 초기 자료를 넣게되면 한글이 깨지게 된다.

이는 간단히 말하면 init sql은 etc/my.cnf에 있는 [client]의 charset을 따르게 된다.

그러므로 밑의 코드를 컨테이너 내부의 etc/my.cnf에 추가하여 작성해주면 된다.

  • mysql container 에는 apt-get 이나 yum이 설치되어 있지 않으므로
    • redhat ootpa는 microdnf 패키지 매니저를 사용 하여야 한다.
    • microdnf install vim

[mysql]
default-character-set=utf8mb4

[client]
default-character-set=utf8mb4

[mysqldump]
default-character-set=utf8mb4

결과

0개의 댓글