정말 한글에 관련한 문제가 많이 생긴다..

이번에 mysql에서 발생한 문제는 콘솔에서는 한글이 정상적으로 보이나.

이상하게도 웹에서는 한글이 모두 ??? 물음표로 보이는 문제 였다..

완전 환장하는 시츄에이션...

결국 해결을 하게 되었는데..

/etc/my.cnf에 다음과 같이 설정을 해주었더니 해결이 되었다..(빨간 부분이다.)

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set = euckr
#language = /usr/local/mysql/share/mysql/korean/
character-set-client-handshake = FALSE


아래의 문서를 보고 확인했습니다.


세상에나..mysql 5.0은 설정방법이 변경되었더군요..

그래서 한글이 계속 웹에서 깨졌었습니다.

 

프로그래밍

페이지 최상단에 항상 아래 코드 입력

<%@ page contentType="text/html; charset=euc-kr" %>

<% request.setCharacterEncoding("euc-kr"); %>

JDBC 연결방법 수정

Connection conn = null;

String jdbcDriver = "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=euc-kr";

String dbUser = "test";
String dbPass = "test1234";
conn = DriverManager.getConnection(jdbcDriver, dbUser, dbPass);

mysql 에서 테이블 속성 변경

mysql 5.0 버전이상에서는 각 테이블마다의 charset 을 지정할 수 있게 되었습니다.

속성을 euckr 로 변경을 하시면 됩니다.

 

다른 방법으로는 테이블을 생성할 때 다음을 추가하시면 됩니다.

create table 'member' (

~~

~~

)ENGINE=MyISAM DEFAULT CHARSET="euckr";

윈도우

mysql 설치디렉토리를 보시면 my.ini 파일이 있습니다. 요넘 수정들어갑니다.

[mysql] 부분

#default-character-set=latin1
default-character-set=euckr

[mysqld] 부분

# The default character set that will be used when a new schema or table is
# created and no character set is defined

default-character-set=euckr
language = "C:/MySQL/MySQL Server 5.0/share/korean"
character-set-client-handshake = FALSE

linux

윈도우 방법하고 별반차이 없습니다. my.conf 파일 수정들어갑니다.

my.cnf 는 /etc/my.conf 에 있습니다.

설마 여기 없다고요?? 그렇다면 #cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf 해주세요

[mysqld] 부분

default-character-set=euckr
language = /usr/local/mysql/share/mysql/korean/
character-set-client-handshake = FALSE

이렇게 해주시고 mysql 다시 시작해주시면 됩니다.
2007/11/26 20:31 2007/11/26 20:31
Posted by 비온뒤하늘

트랙백 보낼 주소 : 이 글에는 트랙백을 보낼 수 없습니다

댓글을 달아주세요

<< PREV : [1] : ... [6] : [7] : [8] : [9] : [10] : [11] : [12] : [13] : [14] : ... [29] : NEXT >>

BLOG main image
마음을 열고 나의 생각을 넣고 나의 미래를 넣고 나의 하루를 넣는다. by 비온뒤하늘

공지사항

카테고리

전체 (29)
태중 세상 보기 (7)
apple (3)
내가 읽은 책들 (0)
리눅스 (9)
나의성공 (6)
태양광 (2)

최근에 달린 댓글

최근에 받은 트랙백

태그목록

글 보관함

달력

«   2010/09   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Total : 11453
Today : 14 Yesterday : 12