Convert mysql data from latin1 to utf-8

chris (2007-07-02 00:33:11)
973 views
0 replies
to convert mysql data and table charsets from latin1 iso-8559-1 to utf-8 is pretty straightforward. I just took on an old database and attempted this conversion just now. This appears to have done the trick:
% /usr/local/mysql/bin/mysqldump databasename tablename -uusername -p> tablename.sql
% iconv -f ISO_8859-1 -t UTF-8 tablename.sql > tableconverted.sql
% /usr/local/mysql/bin//mysql databasename -uroot < tableconverted.sql 
% /usr/local/mysql/bin//mysql databasename -uroot

mysql> alter table tablename convert to character set utf8;
Query OK, 1453459 rows affected (0.44 sec)
Records: 1453459  Duplicates: 0  Warnings: 0

This mysql table data will now show as having a default charset of utf-8 and international characters contained in mysql will all behave as required .. we hope I will explore this a bit more as I get a chance in the next couple weeks and will update this post accordingly.

christo
Digg it! Submit to Slashdot Add to Blinklist Del.icio.us Add to Newsvine Add to Technorati Add it to Google Bookmarks Add to Magnolia
comment