{"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>