Mysqldump error 2013 - corrupt record

First up I realise this may be more of a mysql issue than a strictly RT one, so apologies for that.

I’m trying to dump my rt3 database to restore into a new rt5 instance. The dump fails with

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table Attachments at row: 44697

after about 10 seconds. It’s exactly the same row number every time. After trying many different mysqldump incantations without success, I managed to track down the specific ticket number that it relates to - viewing that ticket in rt3 shows a bunch of errors instead of the content.

mysqlcheck --repair doesn’t work because it’s InnoDB, and most of the solutions I can find say to dump and restore, which is the exact thing I can’t do.

Can anyone suggest anything here? Is it feasible to create a new table and copy over to it? Or delete the offending record manually?

Thanks,
Adam

Ok, looks like I managed to get this sorted.

I was able to narrow down the corrupt records to a range of 10 records, and was able to tip-toe around them.

I created a new temp table:

create table temp like Attachments;

Copied the non-corrupt bits to it:

insert into temp select * from Attachments where id < 78010;
insert into temp select * from Attachments where id > 78020;

Renamed the tables:

rename table Attachments to Attachmentsold;
rename table temp to Attachments;

And finally I was able to dump the database successfully:

mysqldump -u root rt3 --default-character-set=binary --quick --ignore-table rt3.Attachmentsold > /var/rt3_backup.bak