mysql(4.0~5) 한글깨짐방지

1. MySQL 5.0.20 버전을 바이너리로 설치 후에 아래와 같이 복사한다.

cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

(밑줄친 부분은 서버 RAM에 따라 달라질 수 있다.

램용량이 1G정도 라면 my-huge.cnf 파일을 복사한다.

램용량이 512M정도 라면 my-large.cnf 파일을 복사한다. 

총 5가지 경우가 있다.)

 

2. 복사하여 만든 파일(/etc/my.cnf)을 열어서 아래 내용을 추가해 준다. ([mysqld] 부분에 아래 내용을 추가해 준다.)

default-character-set=euckr  =============> "나는 여기서 utf-8로 설정하니까 한글이 보였다
language = /usr/local/mysql/share/mysql/korean/
character-set-client-handshake = FALSE

 

3. 저장하고 MySQL 다시 시작해 준다.

 

 

4.  php.ini --->charset=utf-8 ,or euc-kr, or euc_kr(euckr)

5.  /usr/local/mysql/bin/mysqld_safe --user=mysql(root) --language=korean & 

 

한글로 mysql 과 php를 euc-kr로 하려면

처음부터 mysql을 소스컴파일로 해야 한다 (.configure)

또한 참고사항

=========================================================

레드햇

AddDefaultCharset EUC-KR
LanguagePriority kr en da nl et fr de el it ja no pl pt pt-br ltz ca es sv tw
DefaultLanguage kr


페도라4

한글 설정 :
/etc/httpd/conf/httpd.conf
AddDefaultCharset EUC-KR <== 변경

html에서 php 사용하게 설정 :
/etc/httpd/conf.d/php.conf
AddHandler php5-script .php .html <==  변경

==============================================================================

참고사항

MySQL을 설정하는 방법 (my.ini 파일 수정 후, mysql 재시동)

 

[mysqld]

init_connect = set names euckr
default_character_set=euckr

 

[client]

init_connect = set names euckr
default_character_set=euckr
=============================================================================

참고사항

<meta http-equiv="content-type" content="text/html;charset=euc-kr">

=============================================================================

 

이모든것을 조건으로 해보았는데 한글이 되더라...

mysql..5.0이고 apache 2.0이상이고....php 5.0이상으로 사용했다

그런데 많은 부분이  설정이 안되어있다..설정을 많이 변경해야 한다...

================================================================== 

예_ mysql 5.0이상 소스컴파일시 반드시 이렇게 해야 한다

shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
     shell> cd mysql-VERSION
     shell> ./configure --prefix=/usr/local/mysql --with-charset="euckr"
     shell> make
     shell> make install
     shell> cp support-files/my-medium.cnf /etc/my.cnf
     shell> cd /usr/local/mysql
     shell> bin/mysql_install_db --user=mysql
     shell> chown -R root  .
     shell> chown -R mysql var
     shell> chgrp -R mysql .
     shell> bin/mysqld_safe --user=mysql &

 

 

참고

mysqladmin -uroot -p비밀번호 shutdown

 

나머지

==================================================================

[root@cloud project]# tar zxvf httpd-2.0.40.tar.gz

[root@cloud project]# cd httpd-2.0.40

[root@cloud httpd-2.0.40]# ./configure --prefix=/home/www --enable-so

첫번째 옵션 --prefix=/home/www apache 설치장소를 /home/www 로 정의
(tells configure that we want apache to be installed in directory /home/www If we don't provide a prefix option than it'll be installed in default location, which is /home/www)

두번째 옵션 --enable-so Apache 가 shared 모듈을 load 할수 있도록 허용한다.
(tells Apache to enable module so which enables Apache to load shared modules. We need this option because we are compiling PHP as Apache shared module.
(Ex, php as Apache shared module ))

[root@cloud httpd-2.0.40]# make
[root@cloud httpd-2.0.40]# make install

[root@cloud www]# cd /home/www/conf/
[root@cloud conf]# vi httpd.conf

ServerName 정의하세요.
(Ex. 저의 경우 ServerName 210.101.xxx.xxx 이런식으로 제 아이피를 입력하였습니다. )

이제 아파치 데몬 실행 테스트 해보겠습니다..

[root@cloud conf]# cd /home/www/bin
[root@cloud bin]# ./apachectl start


훗 우선 아파치 설치 성공이군요 :) 이제 아파치 데몬을 중지 시키고 php 을 설치 해보겠습니다.
[root@cloud bin]# ./apachectl stop

 


-------- Compiliing PHP ----------------->

[root@cloud project]# tar zxvf php-4.2.3.tar.gz
[root@cloud project]# cd php-4.2.3

[root@cloud php-4.2.3]#./configure --prefix=/usr/local/php \
--with-apxs2=/home/www/bin/apxs \
--with-config-file-path=/usr/local/php \
--with-mysql=/usr/local/mysql

 

 

 

꼭확인 !!!

 

한글 설정 :
/usr/local/apache/conf/httpd.conf
AddDefaultCharset EUC-KR <== 변경

/usr/local/lib/php.ini/

Defalt_charset "euc-kr" <== 변경

 

<meta http-equiv="content-type" content="text/html;charset=euc-kr">

 

참고로 버젼을 높여보면 더 잘되는경우도 있고 없는경우도 있다 

 



태초에 나는 개그이야기를 만들었다.
내말을 믿고 나를 따르면 천당,
내말을 믿지않고 나를 따르지 않으면 지옥,
나는 하늘나라(우주)에 사느니라.

그럼 난 외계인?