# mysql 또는 root 계정으로 작업을 권장.
vi /etc/my.cnf
# client 부분밑에 추가
[client]
default-character-set = utf8
# mysqld 부분밑에 추가
[mysqld]
init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
character-set-server = utf8
collation-server = utf8_general_ci
# mysqldump 부분밑에 추가
[mysqldump]
default-character-set = utf8
# mysql 부분밑에 추가
[mysql]
default-character-set = utf8
[저장후 나가기]
# Mysql 재시작
service mysqld restart 또는 /etc/init.d/mysqld restart
# UTF8 확인하기
# Mysql 접속
mysql -u root -p [엔터]
# 현재 캐릭터셋 확인
show variables like 'c%'; [엔터]
+--------------------------+-----------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/server/mysql/share/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+-----------------------------------------+
# 위와 같은 형태로 나오면 변경 완료
댓글 없음:
댓글 쓰기