{"id":2050,"date":"2020-06-04T07:46:16","date_gmt":"2020-06-04T05:46:16","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2050"},"modified":"2021-01-21T19:41:38","modified_gmt":"2021-01-21T18:41:38","slug":"mysql-convert-a-column-to-utf-8","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2050","title":{"rendered":"mysql convert a column to utf-8"},"content":{"rendered":"\n<p>You can use this mysql query code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE yourtable MODIFY\n    yourcol VARCHAR(255)\n      CHARACTER SET utf8\n      COLLATE utf8_general_ci;<\/code><\/pre>\n\n\n\n<p>There are more problems with ENUM and SET type fields.<\/p>\n\n\n\n<p>For ENUM you have to specify <em>all<\/em> the field values, no matter how many they are<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE yourtable MODIFY\n    yourcol ENUM('val1','val2',etc)\n      CHARACTER SET utf8\n      COLLATE utf8_general_ci;<\/code><\/pre>\n\n\n\n<p>For SET the problems rise from the name SET, so you have to do this command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE yourtable MODIFY\n    yourcol CHAR(255)\n      CHARACTER SET utf8\n      COLLATE utf8_general_ci;<\/code><\/pre>\n\n\n\n<p>You will be able afterwards to modify CHAR to SET (with your previous values) <em>without losing your data<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use this mysql query code: There are more problems with ENUM and SET type fields. For ENUM you have to specify all the field values, no matter how many they are For SET the problems rise from the name SET, so you have to do this command You will be able afterwards to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=2050\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;mysql convert a column to utf-8&#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":[579,565],"tags":[11,8],"class_list":["post-2050","post","type-post","status-publish","format-standard","hentry","category-database","category-office","tag-mysql","tag-utf-8"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2050"}],"version-history":[{"count":9,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2050\/revisions"}],"predecessor-version":[{"id":2341,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2050\/revisions\/2341"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}