Views 5465 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

MySQL DB에 값을 입력하거나 백업(dump) 파일을 복원할 때 한글 값이 제대로 저장되지 않는 경우가 있다. 이런 경우 대부분 character set 설정문제이며 UTF-8로 설정하면 쉽게 고칠 수 있다.


MySQL 설치 기본 상황

 - latin1으로 Character-Set이 설정되어있다.

 - 한글을 사용하기 위해서는 UTF-8로 변경하면 사용할 수 있다.



MySQL 한글 깨짐 현상 해결하기

 - 한글을 저장하면 아래와 같은 ??? 형태의 모습을 볼 수 있다.

+---+-----+
|id |name |
+---+-----+
|1  |???  |
|2  |???  |
+---+-----+



설정파일 변경하기

 - /etc/mysql/my.cnf 파일 변경하기

 - 파일의 경로는 플랫폼에 따라 다를 수 있다.


# 추가 해줘야 할 내용

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8



기존의 만들어져있던 Database나 Table들의 Character-Set이 변경되는 것은 아니므로 직접 변경을 해줘야 한다.



# 기존의 Database의 Character-Set 속성 변경하기

mysql> ALTER DATABASE [DB명] DEFAULT CHARACTER SET utf8;



# 현재 Character-Set 확인하기

mysql> show variables like ‘c%’
mysql> status



# MySQL 재시작하기

[root@hooni ~]# service mysql restart




?

List of Articles
No. Category Subject Author Date Views
1077 System/OS [linux] ipchains 사용예(패킷 필터링) hooni 2003.04.23 14171
1076 System/OS [linux] ipfwadm를 이용한 패킷필터링(구버전) hooni 2003.04.23 13015
1075 System/OS [windows] 98/ME 속도 빠르게 튜닝(부팅,메모리,레지스터) hooni 2003.04.23 50439
1074 System/OS [windows] 도스 사용 팁 hooni 2003.04.23 17806
1073 System/OS [windows] 여러가지 활용 팁 hooni 2003.04.23 19969
1072 System/OS [windows] 배치(bat)파일 제작 방법 hooni 2003.04.23 17002
1071 System/OS [linux] 패킷 스니퍼링 hooni 2003.04.23 16315
1070 System/OS [linux] 패킷의 소스 주소 바꾸기 hooni 2003.04.23 18784
1069 System/OS [linux] iptables 명령어 매뉴얼(options) hooni 2003.04.23 11333
1068 System/OS [linux] 간단한 NAT 설정 script hooni 2003.04.23 12597
1067 System/OS [linux] 랜카드 2개 설정 & iptables 로 사설 ip.. hooni 2003.04.23 14732
1066 System/OS [linux] apache, php, jsp 환경설정하기.. hooni 2003.04.23 15232
1065 System/OS [linux] Oracle8.1.6, Mysql+PHP+Zend Optimizer+APACHE+Tomcat(jsp,servlet)+IMAP+gd hooni 2003.04.23 32452
1064 System/OS [linux] 특수문자 환경 설정(stty) hooni 2003.04.23 15275
1063 System/OS [linux] 메타(기호)문자의 의미와 사용 hooni 2003.04.23 16384
1062 System/OS [linux] 프로세스 상태확인(ps) hooni 2003.04.23 12703
Board Pagination Prev 1 5 6 7 8 9 ... 74 Next
/ 74