#virtual box内のubuntu 10.04のmysqlの文字コードをutf8に変更する
$ mysql -u root -p
mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
$ sudo vim /etc/mysql
#/etc/my.cnfに以下の6行を追記する。
sudo vim /etc/mysql/my.cnf
[mysqld]
default-character-set=utf8
character_set_server=utf8
skip-character-set-client-handshake
[mysql]
default-character-set=utf8
#mysqlの再起動
$ sudo /etc/init.d/mysql restart
mysql> show variables like 'char%';
+--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
#文字コードは無事utf8に統一された。