{"id":43,"date":"2006-06-20T19:56:36","date_gmt":"2006-06-20T18:56:36","guid":{"rendered":"https:\/\/www.dont-panic.cc\/capi\/archives\/43"},"modified":"2009-07-09T06:50:17","modified_gmt":"2009-07-09T05:50:17","slug":"bugzilla-upgrading-mysql-database-from-latin1-to-utf8","status":"publish","type":"post","link":"https:\/\/www.dont-panic.cc\/capi\/2006\/06\/20\/bugzilla-upgrading-mysql-database-from-latin1-to-utf8\/","title":{"rendered":"Bugzilla: Upgrading MySQL Database from Latin1 to UTF8"},"content":{"rendered":"<div style=\"border-style: dashed; border-width: 1px; margin-bottom: 14px;padding: 4px; background: #f0f0f0;\"><strong>IMPORTANT Update 2009-07-09:<\/strong> This information is already several years old! You should not use this information for modern versions of Bugzilla (3.2 and above), which will allow you to convert to UTF-8 using checksetup.pl.<\/div>\n<p>In the present case, we have a <a href=\"http:\/\/www.bugzilla.org\/\">Bugzilla<\/a> database created with a charset of latin1. Unfortunately, now after updating MySQL to 4.1, error occured when trying to assign a new developer to a bug, indicating mismatch of collations (UTF-8 vs. Latin1). This is caused by the fact that there is now latin1-data stored in an UTF-8 table.<\/p>\n<p>The following procedure can be used to upgrade the database to UTF-8, eliminating the problem:<\/p>\n<ol style=\"margin: 2em; text-align: left\">\n<li><code>mysqldump -p --default_character-set=latin1 --skip-set-charset bugs &gt; dump.sql<\/code><\/li>\n<li><code>mysql -p --execute=\"DROP DATABASE bugs; CREATE DATABASE bugs CHARACTER SET utf8 COLLATE utf8_general_ci;\"<\/code><\/li>\n<li><code>mysql -p --default-character-set=utf8 bugs &lt; dump.sql<\/code><\/li>\n<li><code>perl -pe 's\/latin1_bin\/utf8_general_ci\/g; s\/latin1\/utf8\/g' dump.sql &gt; dump-utf8.sql<\/code><\/li>\n<li><code>mysql -p --default-character-set=utf8 bugs &lt; dump-utf8.sql<\/code><\/li>\n<\/ol>\n<p>You should of course always check if the Pearl-RegEx only replaced charset declarations and not some matches within the data.<\/p>\n<p>Thanks to <a href=\"http:\/\/textsnippets.com\/posts\/show\/84\">TextSnippets<\/a> for the script.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IMPORTANT Update 2009-07-09: This information is already several years old! You should not use this information for modern versions of Bugzilla (3.2 and above), which will allow you to convert to UTF-8 using checksetup.pl. In the present case, we have a Bugzilla database created with a charset of latin1. Unfortunately, now after updating MySQL to &hellip; <a href=\"https:\/\/www.dont-panic.cc\/capi\/2006\/06\/20\/bugzilla-upgrading-mysql-database-from-latin1-to-utf8\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Bugzilla: Upgrading MySQL Database from Latin1 to UTF8&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[86,88,89,91,92,87,90],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-sysadmin","tag-admin","tag-bugzilla","tag-charset","tag-internationalization","tag-latin1","tag-mysql","tag-utf8"],"_links":{"self":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":3,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/43\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}