Study/MySQL
[MySQL] ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.
나른한댕댕이🐶
2023. 8. 2. 11:09
728x90
반응형
# 배경
데이터를 백업하고 복원하는 작업을 진행하였다.
복원하는 작업을 진행하는 중에 다음과 같은 에러가 뜨면서 복원이 진행되지 않았다.
ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode.
Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.
# 문제
서버가 달라지면서 인코딩이 달라져서 한글이 깨져서 복원하는데 문제가 생긴 것이었다.
# 해결 방법
백업하는 과정에서 캐릭터 셋 옵션을 주어서 해당 문제를 해결할 수 있다.
mysqldump -h {host addr} \
-u {user} \
-p {DB Name} --default-character-set utf-8 > backup.sql
728x90
반응형