{"id":39670,"date":"2020-09-11T11:57:55","date_gmt":"2020-09-11T04:57:55","guid":{"rendered":"https:\/\/harry.sufehmi.com\/?p=39670"},"modified":"2020-09-11T11:58:40","modified_gmt":"2020-09-11T04:58:40","slug":"cutting-a-table-out-of-a-mysqldump-output-file","status":"publish","type":"post","link":"https:\/\/harry.sufehmi.com\/archives\/2020-09-11-cutting-a-table-out-of-a-mysqldump-output-file\/","title":{"rendered":"Cutting a Table out of a mysqldump output file"},"content":{"rendered":"\n

I was restoring the backup of a MySQL 5.x server into MySQL 8.x server – and found out that it corrupt the MySQL 8.x ‘s mysql table<\/p>\n\n\n\n

Which stores the usernames and passwords. <\/p>\n\n\n\n

So I had to delete the mysql table from the backup, before trying to restore it again<\/p>\n\n\n\n

Turn out it’s pretty easy, just will take some time since it’s a pretty big backup :<\/p>\n\n\n\n

# search for beginning of 'mysql' table\ncat backup.mysql | grep -n Current Database: `mysql`\n\n# 155604:-- Current Database: `mysql`\n\n# search for ending of 'mysql' table\ntail -n +155604 backup.mysql | grep -n \"Current Database\"\n\n# 1:  -- Current Database: `mysql`\n# 916:-- Current Database: `phpmyadmin`\n\n# cut that table out\nhead -155603 backup.mysql                > new.mysql\ntail -n +$(( 155603+916 )) backup.mysql >> new.mysql\n\n# voila !<\/code><\/pre>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

I was restoring the backup of a MySQL 5.x server into MySQL 8.x server – and found out that it corrupt the MySQL 8.x ‘s mysql table Which stores the usernames and passwords. So I had to delete the mysql table from the backup, before trying to restore it again Turn out it’s pretty easy, … Continue reading Cutting a Table out of a mysqldump output file<\/span> →<\/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":[51,2],"tags":[],"class_list":["post-39670","post","type-post","status-publish","format-standard","hentry","category-open-source","category-teknoblogia"],"_links":{"self":[{"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/posts\/39670"}],"collection":[{"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/comments?post=39670"}],"version-history":[{"count":2,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/posts\/39670\/revisions"}],"predecessor-version":[{"id":39672,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/posts\/39670\/revisions\/39672"}],"wp:attachment":[{"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/media?parent=39670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/categories?post=39670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/harry.sufehmi.com\/wp-json\/wp\/v2\/tags?post=39670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}