How to convert an entire MySQL database characterset and collation to UTF-8?

Use the <a href=”#”><code>ALTER DATABASE</code></a> and <a href=”http://dev.mysql.com/doc/refman/5#”><code>ALTER TABLE</code></a> commands. <pre><code><span class=”kwd”>ALTER </span><span class=”kwd”>DATABASE</span><span class=”pln”> databasename CHARACTER </span><span class=”kwd”>SET</span><span class=”pln”> utf8 </span><span class=”kwd”>COLLATE</span><span class=”pln”> utf8_general_ci</span><span class=”pun”>; </span><span class=”kwd”>ALTER </span><span class=”kwd”>TABLE</span><span class=”pln”> tablename </span><span class=”kwd”>CONVERT</span><span class=”kwd”>TO</span><span class=”pln”> CHARACTER </span><span class=”kwd”>SET</span><span class=”pln”> Read More …