-1

I have a big problem with a MySQL database stored on my raspberry (InnoDB engine). I'm not very expert in this field but I'll try to explain to you the problem.

MySQL crash everytime that I try to start it and I need to recover the data stored inside the DB. The error is:

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I just tried to start MySQL with the innodb_force_recovery flag from 1 to 6 but it still crashing. From the log I understood that the problem is a corruption inside some tables.

I tried to check my database file with https://recovery.twindb.com/ and it shows that some tables inside "mysql" database need to be recovered and the tables inside "production" database (the mine) are ok, indeed I can see all my data on this website. How can easly recover my data? There is some free tools or script that I can use? I have all files as ibdata01, *.frm, *.ibd

diegocom
  • 338
  • 1
  • 7
  • 22

2 Answers2

0

You can use Undrop for InnoDB a tool behind recovery.twindb.com. To recover corrupt database you need to follow steps from https://twindb.com/recover-corrupt-mysql-database/

Parse the ibd file:

# ./stream_parser -f /var/lib/mysql/sakila/actor.ibd

The dump records from the PRIMARY index:

# ./c_parser -6f pages-actor.ibd/FIL_PAGE_INDEX/0000000000000015.page \
    -t sakila/actor.sql \
    > dumps/default/actor 2>&1 dumps/default/actor_load.sql

Then load the dump:

# mysql --local-infile sakila < dumps/default/actor_load.sql
akuzminsky
  • 2,190
  • 15
  • 21
-1

Due to some major changes In IBD file. It maybe corrupted.

Solution - Recreate the structure from the FRM files.

MySQL provides a utility named “mysqlfrm” to recreate the table structure. This utility extracts the structure and creates a “Create table” script. mysqlfrm –server=root:mypassword@localhost –port=3311 “<source/path>/mytable.frm” > “<destination/path>/recovered_mytable.sql”

The port in the instruction is not the port of MySQL server, it is any available port. The end of the script is meant to redirect the output in a file.

If, the give solution does not work, Please visit the complete guide of How to restore tables from .IBD file.

Thanks