/etc/mysql/my.cnf 파일을 열고 아래 내용을 추가한다.
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8 default-collation=utf8_general_ci init_connect=set collation_connection=utf8_general_ci init_connect=set names utf8 character-set-server=utf8 collation-server=utf8_general_ci character-set-client-handshake = TRUE
[mysql]
default-character-set=utf8
mac osx 에서는 위에 있는 것을 다 할 필요 없이 몇가지만 입력하면 되더라. mac에서는
/usr/local/mysql/support-files$ sudo cp my-medium.cnf /etc/my.cnf한 다음 my.cnf 를 수정한다.
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8 collation-server=utf8_general_ci
[mysql]
default-character-set=utf8
아래와 같이 나오면 된듯 하다.
mysql> 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/share/mysql/charsets/ | | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | | completion_type | 0 | | concurrent_insert | 1 | | connect_timeout | 10 | +--------------------------+----------------------------+ 14 rows in set (0.00 sec)