How to convert a MySQL database from latin1 to UTF-8
Install recode
$ sudo yum install recode
- Dump the database:
$ mysqldump -u<username> -p --default-character-set=latin1 --skip-set-charset <db_name> > /var/tmp/dump.sql
- Edit the dump file and change all character set references from latin1 to utf8.
- Convert it to UTF-8 using recode
$ recode latin1..utf8 dump.sql
- Load the utf dumpfile back into the database:
$ mysql -u<username> -p --default-character-set=utf8 <db_name> < /var/tmp/dump.sql
