캐릭터 셋 utf-8 에서 euckr 로 바꾸는 예제
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 를 수정.
'Database > MySQL' 카테고리의 다른 글
MariaDB Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MariaDB server (0) | 2016.08.08 |
---|---|
mysql jdbc test code (0) | 2016.07.28 |
error: 'Access denied for user 'root'@'localhost' (using password: NO)' (0) | 2016.07.27 |
Table character set 확인 방법 (0) | 2016.07.11 |
MySQL 예약어 (0) | 2013.03.05 |
댓글