Part1: Change MySQL Default character set to utf8 in my. CNF
Http://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf8-in-my-cnf
[Mysqld]
Init_connect = 'set collation_connection = utf8_unicode_ci'
Init_connect = 'set names utf8'
Character-set-Server = utf8
Collation-Server = utf8_unicode_ci
Skip-character-set-client-handshake
[Client]
Default-character-set = utf8
[MySQL]
Default-character-set = utf8
Part2: changing the character set of an existing database
Mysql> alter database zuche_production Character Set utf8 collate utf8_unicode_ci;
Query OK, 1 row affected (0.00 Sec)
Part3: useful statements
Mysql> show table status from zuche_production;
Mysql> show variables like "% character %"; show variables like "% collation % ";
+ -------------------------- + ---------------------------- +
| 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/|
+ -------------------------- + ---------------------------- +
8 rows in SET (0.00 Sec)
+ ---------------------- + ----------------- +
| Variable_name | value |
+ ---------------------- + ----------------- +
| Collation_connection | utf8_unicode_ci |
| Collation_database | utf8_unicode_ci |
| Collation_server | utf8_unicode_ci |
+ ---------------------- + ----------------- +
3 rows in SET (0.00 Sec)