Tuesday, January 14, 2014

UTF8 issue after upgrading MySQL to 5.5

In MySQL 5.5.X it introduce utf8mb4 and lead to old table might have coding issue.

<my.cnf>

[client]
default_character_set = utf8mb4

[mysql]
default-character-set=utf8mb4
skip-character-set-client-handshake

[mysqld]
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
init-connect = 'SET NAMES utf8mb4'
skip-character-set-client-handshake


----------
Convert your table / column collation

ALTER TABLE mytable CONVERT TO CHARACTER SET utf8mb4
ALTER DATABASE  `databasename` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci

No comments:

Post a Comment