서버환경
MySQL5.X
PHP 5.X
CentOS 7
mysql을 euckr 컴파일해도 php에서 접속하니 latin1 로 나옴.. ㅡㅡ;;
리눅스에서 MySQL 접속
$sql = "show variables like '%character%'";
character_set_client : euckr
character_set_connection : euckr
character_set_database : euckr
character_set_results : euckr
character_set_server : euckr
character_set_system : utf8
character_sets_dir : /usr/local/mysql/share/mysql/charsets/
PHP에서 MySQL 접속
$sql = "show variables like '%character%'";
character_set_client : latin1
character_set_connection : latin1
character_set_database : euckr
character_set_results : latin1
character_set_server : euckr
character_set_system : utf8
character_sets_dir : /usr/local/mysql/share/mysql/charsets/
해결방법
/etc/ld.so.conf.d/mariadb-x86_64.conf 이름변경
ld.so.conf에서 ld.so.conf.d/아래 .conf 파일을 참고하므로 mariadb-x86_64.conf_bak으로 변경
#cd /etc/ld.so.conf.d
#mv mariadb-x86_64.conf mariadb-x86_64.conf_bak
설치한 mysql 디렉토리 설정
#vi mysql.conf
/usr/local/mysql/lib 입력 후 저장
#ldconfig
다시 테스트
$sql = "show variables like '%character%'";
character_set_client : euckr
character_set_connection : euckr
character_set_database : euckr
character_set_results : euckr
character_set_server : euckr
character_set_system : utf8
character_sets_dir : /usr/local/mysql/share/mysql/charsets/
mysql_set_charset($charset); 이나 mysql_query("SET NAMES euckr"); 필요없음!!