Tuesday, January 26, 2010

[Level 2] Convert character set in MySQL

How to convert character set from Big5 to UTF-8 in MySQL.

After MySQL 4.1, you can use alter command to convert character.

alter all column in one command:
mysql> alter table table_name convert to character set 'utf8';

Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0



mysql>



alter each column in one command:
mysql> alter table orb modify a varchar(32) character set 'utf8';
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0



mysql>



Wish this helps.

regards,
Stanley Huang