{"id":6946,"date":"2022-10-26T17:01:22","date_gmt":"2022-10-26T17:01:22","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=6946"},"modified":"2023-11-21T17:00:04","modified_gmt":"2023-11-21T17:00:04","slug":"6946","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2022\/10\/26\/6946\/","title":{"rendered":"ERROR 1253 (42000) at line 31: COLLATION &#8216;utf8mb4_unicode_ci&#8217; is not valid for CHARACTER SET &#8216;utf8&#8217;"},"content":{"rendered":"<p>Mysql import error was shown when exporting a database from cPanel to a local server.<\/p>\n<p>During the migration of a web application, I got the below error while restoring a database on another server. The collation id may differ based on the MySQL version.<\/p>\n<p>Error message:<\/p>\n<pre><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmysql backup.sql &amp;amp;amp;lt; backup.sql\nERROR 1253 (42000) at line 31: COLLATION &#039;utf8mb4_unicode_ci&#039; is not valid for CHARACTER SET &#039;utf8&#039;\n<\/pre>\n<p>The MySQL server running on the new server is an older version than the source server. The destination server doesn\u2019t contain the required database collation.<\/p>\n<p>To resolve, edit the database backup file in text editor and replace \u201cutf8mb4_0900_ai_ci\u201d with \u201cutf8mb4_unicode_ci\u201d<\/p>\n<p>The Linux system users can use the sed command to replace text in files directly.<\/p>\n<pre><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsed -e &#039;s\/utf8mb4_0900_ai_ci\/utf8mb4_unicode_ci\/g&#039; -i myfilename.sql\n<\/pre>\n<p>That it. after the above changes, the database was successfully restored!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mysql import error was shown when exporting a database from cPanel to a local server. During the migration of a web application, I got the below error while restoring a database on another server. The collation id may differ based on the MySQL version. Error message: mysql backup.sql &amp;amp;amp;lt; backup.sql ERROR 1253 (42000) at line &#8230; <a title=\"ERROR 1253 (42000) at line 31: COLLATION &#8216;utf8mb4_unicode_ci&#8217; is not valid for CHARACTER SET &#8216;utf8&#8217;\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2022\/10\/26\/6946\/\" aria-label=\"Read more about ERROR 1253 (42000) at line 31: COLLATION &#8216;utf8mb4_unicode_ci&#8217; is not valid for CHARACTER SET &#8216;utf8&#8217;\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"class_list":["post-6946","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=6946"}],"version-history":[{"count":2,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6946\/revisions"}],"predecessor-version":[{"id":9032,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6946\/revisions\/9032"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=6946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=6946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=6946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}