MySQL mysql-character-set
페이지 정보
본문
1. Mysql 환경설정 - 한글개발환경(euckr)일 경우
# vi /etc/mysql/my.cnf
[mysql]
default-character-set = euckr
[mysqld]
character-set-client-handshake=FALSE
init_connect="SET collation_connection = euckr_korean_ci"
init_connect="SET NAMES euckr"
default-character-set = euckr
character-set-server = euckr
collation-server = euckr_korean_ci
[client]
default-character-set = euckr
[mysqldump]
default-character-set = euckr
2. mysql 재시작
# /etc/init.d/mysqld restart
# /etc/init.d/mysqld restart
3. mysql을 root 계정으로 접속
# mysql -uroot -p
mysql> status 에서 아래와 같이 나오면 설정 OK.
--------------
mysql Ver 14.12 Distrib 5.0.37, for Win32 (ia32)
Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.0.77 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: euckr
Db characterset: euckr
Client characterset: euckr
Conn. characterset: euckr
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 1 min 58 sec
Threads: 1 Questions: 4 Slow queries: 0 Opens: 12 Flush tables: 1 Open tabl
es: 6 Queries per second avg: 0.400
--------------
2. Mysql 환경설정 - 다국어 개발환경(utf-8)일 경우
window -> C:\Windows 밑에 my.ini 파일에 추가
ubuntu -> /etc/mysql/my.cnf 파일에 추가
[mysql]
default-character-set = utf8
[mysqld]
character-set-client-handshake=FALSE
init_connect="SET collation_connection = utf8_general_ci"
init_connect="SET NAMES utf8"
default-character-set = utf8
character-set-server = utf8
collation-server = utf8_general_ci
[client]
default-character-set = utf8
[mysqldump]
default-character-set = utf8
Mysql Restart
root 계정으로 mysql 접속후
mysql>status
아래와 같이 나오면 설정 OK.
mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.37, for Win32 (ia32)
Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.0.37-community MySQL Community Edition (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 10 sec
Threads: 1 Questions: 4 Slow queries: 0 Opens: 12 Flush tables: 1 Open tabl
es: 6 Queries per second avg: 0.400
--------------
# mysql -ujavamaster -p1234 myproject_utf8
mysql> set names euckr;
utf8 환경일 경우 도스프롬프트에서 테이블에 한글문자를 등록(insert)하거나 한글을 조회(select)시 깨져보임. set names euckr; 로 설정을 바꾸면 한글이 제대로 보임(Mysql 5일 경우)
자료출처
http://www.ssial.com/7
댓글목록
등록된 댓글이 없습니다.