{"id":25,"date":"2020-04-26T11:38:20","date_gmt":"2020-04-26T11:38:20","guid":{"rendered":"https:\/\/wp.sheepchen.net\/?p=25"},"modified":"2020-06-03T14:13:41","modified_gmt":"2020-06-03T14:13:41","slug":"how-to-export-import-mysql-database-with-exact-character-set","status":"publish","type":"post","link":"https:\/\/wp.sheepchen.net\/?p=25","title":{"rendered":"How to export\/import MySQL database with exact character set?"},"content":{"rendered":"\n<pre class=\"wp-block-sentidoweb-snippet\"><code class=\"\">mysqldump -uUSERNAME -pPASSWORD --default-character-set=utf8 DATABASE > backup.sql<\/code><\/pre>\n\n\n<p>When you import backup into an empty MySQL database, you can set the exact character set for the data that will be inserted. To do this, use the following command:<\/p>\n\n\n<pre class=\"wp-block-sentidoweb-snippet\"><code class=\"\">mysql -uUSERNAME -pPASSWORD --default-character-set=utf8 DATABASE &lt; backup.sql<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>Replace &#8211;default-character-set=utf8 with the charset used for the creation of the backup.sql file. This will ensure that your data is inserted correctly.<\/p>\n<\/div><\/div>\n\n\n<p><strong>character-set UTF8 vs UTF8MB4<\/strong><\/p>\n<p>MySQL utf8 is a propiatary standard from MySQL which does not reflect the real utf-8 standard. It uses only max. 3 bytes for a character. If you want to use real utf8 in your database you should use utf8mb4.<\/p>\n\n<h6>source: <a href=\"https:\/\/www.siteground.com\/kb\/importexport_mysql_database\/\">siteground.com<\/a>, <a href=\"https:\/\/www.hydroxi.de\/utf8-vs-utf8mb4\/\">hydroxi.de<\/a><\/h6>","protected":false},"excerpt":{"rendered":"<p>When you import backup into an empty MySQL database, you can set the exact character set for the data that will be inserted. To do this, use the following command: Replace &#8211;default-character-set=utf8 with the charset used for the creation of the backup.sql file. This will ensure that your data is inserted correctly. character-set UTF8 vs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":10,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":61,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/61"}],"wp:attachment":[{"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.sheepchen.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}