HOWTO: Convert mysql data to UTF-8 quickly

I’ve been revamping my Bolivian soccer blog, which I finally updated and made live tonight.  In doing so, I needed to convert the data from ISO-8859-1 (back when I didn’t know better about how to setup a database) to UTF-8.  I was fearing the process would be complicated and tedious, involving some script to read the data and use PHP’s mbstring or iconv extensions to do the work.  Thanks to a post on a Mysql message board (I wish I’d saved the link, I’d give you full credit), it turned out to be a drop dead simple, or is it quick-and-dirty, 3 step process at the command line using the iconv tool.

$ mysqldump --opt --quote-names my_database &gt; my_database.sql<br />$ iconv -f ISO_8859-1 -t UTF-8 my_database.sql &gt; my_database-utf-8.sql<br />$ mysql my_database &lt; my_database-utf-8.sql<br />