바로가기 메뉴
본문내용 바로가기
메인메뉴 바로가기



Customer Center

Notice · Security Issue · Account Guide · Global Traffic Test

HOME > Customer Center > Tech Note

기술노트

mysql character_set 변경
2016.02.18

1) 확인

mysql> show variables like "c%";

+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | utf8 | <- 변경
| character_set_connection | utf8 | <- 변경
| character_set_database | utf8 | <- 변경
| character_set_filesystem | binary |
| character_set_results | utf8 | <- 변경
| character_set_server | utf8 | <- 변경
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
| collation_connection | utf8_general_ci | <- 변경
| collation_database | utf8_general_ci | <- 변경
| collation_server | utf8_general_ci | <- 변경
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+----------------------------------------+


2) 변경 (일시적인 방법. MySQL을 재시작 하면 원래 값으로 돌아간다.)
msyql> set character_set_client = euckr;
msyql> set character_set_connection = euckr;
msyql> set character_set_database = euckr;
msyql> set character_set_results = euckr;
msyql> set character_set_server = euckr;
mysql> set collation_connection = euckr_korean_ci;
mysql> set collation_database = euckr_korean_ci;
mysql> set collation_server = euckr_korean_ci;
3) 확인
mysql> show variables like "c%";
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | euckr |
| character_set_connection | euckr |
| character_set_database | euckr |
| character_set_filesystem | binary |
| character_set_results | euckr |
| character_set_server | euckr |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
| collation_connection | euckr_korean_ci |
| collation_database | euckr_korean_ci |
| collation_server | euckr_korean_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+----------------------------------------+


4) 변경2 (온전한 변경 방법)

/etc/my.cnf 파일을 변경 해줍니다.

[client]
default-character-set=euckr

[mysqld]
default-character-set=euckr
init_connect=SET collation_connection=euckr_korean_ci
init_connect=SET NAMES euckr
character-set-server=euckr
collation-server=euckr_korean_ci

[mysqldump]
default-character-set=euckr

[mysql]
default-character-set=euckr

추가 및 변경 후, MySQL 을 재시작 해주어야 적용된다.


5) 아파치 캐릭터셋 확인

/usr/local/apache/conf/httpd.conf 파일을 변경(내용 추가)해줍니다.

AddCharset EUC-KR .euc-kr

참고1 : UTF-8사용 : AddCharset UTF-8 .utf8
참고2 : Apache 버젼 2.2.6 이상의 경우, /usr/local/apache/conf/extra/httpd-languages.conf 를 수정.


이호스트데이터센터(http://www.ehostidc.co.kr)
첨부파일