文字コードをutf8に変える
設定ファイルは以下
/etc/my.cnf
[mysqld]
の項目に
character-set-server=utf8
を追記。
書き換えたら再起動
/etc/rc.d/init.d/mysqld restart
起動できないときは、エラーログを確認
$ tail /var/log/mysqld.log
mysql> show variables like "char%";
を見ると、
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
が
+--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
と変わっている。
PR