{"id":127,"date":"2010-04-01T05:03:41","date_gmt":"2010-04-01T03:03:41","guid":{"rendered":"http:\/\/www.badral.net\/?p=127"},"modified":"2010-04-05T18:25:40","modified_gmt":"2010-04-05T16:25:40","slug":"mysql-database-migration-from-latin1-to-utf8","status":"publish","type":"post","link":"https:\/\/www.badral.net\/?p=127","title":{"rendered":"MySQL database migration from Latin1 to UTF8"},"content":{"rendered":"<p>\u04e8\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u0445\u0443\u0443\u0447\u0438\u043d \u0431\u043b\u043e\u0433\u043e\u043e \u0437\u04e9\u04e9\u0436 \u0431\u0430\u0439\u0442\u0430\u043b \u043d\u044d\u0433\u044d\u043d \u0430\u0441\u0443\u0443\u0434\u0430\u043b \u0433\u0430\u0440\u043b\u0430\u0430. \u0423\u0447\u0438\u0440 \u043d\u044c \u0431\u043b\u043e\u0433 \u043c\u0430\u0430\u043d\u044c \u044e\u043d\u0438\u043a\u043e\u0434\u043e\u043e\u0440 \u0431\u0438\u0447\u0438\u0433\u0434\u044d\u0436 \u0431\u0430\u0439\u0441\u0430\u043d \u0447 latin1 \u0442\u044d\u043c\u0434\u044d\u0433\u0442 \u043a\u043e\u0434\u0447\u043b\u043e\u043b\u043e\u043e\u0440 \u04e9\u0433\u04e9\u0433\u0434\u043b\u0438\u0439\u043d \u0441\u0430\u043d\u0434 \u0445\u0430\u0434\u0433\u0430\u043b\u0430\u0433\u0434\u0441\u0430\u043d \u0431\u0430\u0439\u0436\u044d\u044d. \u0418\u043d\u0433\u044d\u044d\u0434 \u043d\u04e9\u0433\u04e9\u04e9 \u0430\u0440\u0437\u0430\u0439\u0441\u0430\u043d \u0431\u0438\u0447\u0432\u044d\u0440\u044d\u044d UTF8 \u0431\u043e\u043b\u0433\u043e\u043b\u043e\u043e. \u042d\u043d\u044d\u0445\u04af\u04af \u0430\u0440\u0433\u044b\u0433 \u0431\u0438 \u04af\u0440\u0433\u044d\u043b\u0436 \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0434\u044d\u0433 \u0431\u04e9\u0433\u04e9\u04e9\u0434 \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0445 \u0445\u044d\u0440\u044d\u0433\u0446\u044d\u044d \u0438\u0445 \u0433\u0430\u0440\u0434\u0430\u0433 \u0442\u0443\u043b \u044d\u043d\u0434 \u0431\u0438\u0447\u043b\u044d\u044d.<\/p>\n<pre style=\"overflow:scroll\"># mysqldump -u dbuser -pdbpass --opt --skip-set-charset --default-character-set=latin1 --skip-extended-insert databasename &gt; database.sql\r\n# sed -i 's\/DEFAULT CHARSET=latin1\/DEFAULT CHARSET=utf8\/g' database.sql \/\/ \u044d\u0441\u0432\u044d\u043b perl -i -pe 's\/DEFAULT CHARSET=latin1\/DEFAULT CHARSET=utf8\/' database.sql \u0433\u044d\u0441\u044d\u043d \u0447 \u0431\u043e\u043b\u043d\u043e.\r\n# sed -i '1i SET NAMES utf8;' database.sql \/\/ \u044d\u0441\u0432\u044d\u043b \u044f\u043c\u0430\u0440 \u043d\u044d\u0433 \u0437\u0430\u0441\u0432\u0430\u0440\u043b\u0430\u0433\u0447\u0430\u0430\u0440 vi database.sql \u0433\u044d\u0434\u044d\u0433 \u0447 \u044e\u043c \u0443\u0443 \u043d\u044d\u044d\u0433\u044d\u044d\u0434 \u0442\u043e\u043b\u0433\u043e\u0439\u0434 \u043d\u044c \"SET NAMES utf8;\" \u0433\u044d\u0441\u044d\u043d \u043c\u04e9\u0440 \u043d\u044d\u043c\u043d\u044d.\r\n# cat database.sql | mysql -u dbuser -pdbpass\r\n<\/pre>\n<p>\u0418\u043d\u0433\u044d\u044d\u0434 \u043b \u0431\u043e\u043b\u043b\u043e\u043e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u04e8\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u0445\u0443\u0443\u0447\u0438\u043d \u0431\u043b\u043e\u0433\u043e\u043e \u0437\u04e9\u04e9\u0436 \u0431\u0430\u0439\u0442\u0430\u043b \u043d\u044d\u0433\u044d\u043d \u0430\u0441\u0443\u0443\u0434\u0430\u043b \u0433\u0430\u0440\u043b\u0430\u0430. \u0423\u0447\u0438\u0440 \u043d\u044c \u0431\u043b\u043e\u0433 \u043c\u0430\u0430\u043d\u044c \u044e\u043d\u0438\u043a\u043e\u0434\u043e\u043e\u0440 \u0431\u0438\u0447\u0438\u0433\u0434\u044d\u0436 \u0431\u0430\u0439\u0441\u0430\u043d \u0447 latin1 \u0442\u044d\u043c\u0434\u044d\u0433\u0442 \u043a\u043e\u0434\u0447\u043b\u043e\u043b\u043e\u043e\u0440 \u04e9\u0433\u04e9\u0433\u0434\u043b\u0438\u0439\u043d \u0441\u0430\u043d\u0434 \u0445\u0430\u0434\u0433\u0430\u043b\u0430\u0433\u0434\u0441\u0430\u043d \u0431\u0430\u0439\u0436\u044d\u044d. \u0418\u043d\u0433\u044d\u044d\u0434 \u043d\u04e9\u0433\u04e9\u04e9 \u0430\u0440\u0437\u0430\u0439\u0441\u0430\u043d \u0431\u0438\u0447\u0432\u044d\u0440\u044d\u044d UTF8 \u0431\u043e\u043b\u0433\u043e\u043b\u043e\u043e. \u042d\u043d\u044d\u0445\u04af\u04af \u0430\u0440\u0433\u044b\u0433 \u0431\u0438 \u04af\u0440\u0433\u044d\u043b\u0436 \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0434\u044d\u0433 \u0431\u04e9\u0433\u04e9\u04e9\u0434 \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0445 \u0445\u044d\u0440\u044d\u0433\u0446\u044d\u044d \u0438\u0445 \u0433\u0430\u0440\u0434\u0430\u0433 \u0442\u0443\u043b \u044d\u043d\u0434 \u0431\u0438\u0447\u043b\u044d\u044d. # mysqldump -u dbuser -pdbpass &#8211;opt &#8211;skip-set-charset &#8211;default-character-set=latin1 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[15],"class_list":["post-127","post","type-post","status-publish","format-standard","hentry","category-4","category-1","tag-mysql-database-migration"],"_links":{"self":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/127"}],"collection":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127"}],"version-history":[{"count":7,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":130,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions\/130"}],"wp:attachment":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}