Recover Mysql data from formated hard disk One of my machine got crashed last day and i ended up reinstalling windows on that machine. It had a mysql server in it. Is there a way to recover mysql data from that machine now . There are couple of tables which has some important data for which backup was not there.

any help would be greatly appreciated.
Before you do anything make sure nothing can overwrite data on the disk. stop all writes to the disk ASAP. Unmount, take it out of a server - whatever is applicable and feasible. Plug the disk in a 64bit Linux machine.

Then you need to take an image from this disk. I prefer dd for the job. It's available everywhere, stores the image as it is.

 dd if=/dev/sdb of=/path/on/sda/faulty_disk.img  conv=noerror


Where /dev/sdb is the disk with data and /path/on/sda/faulty_disk.img is a path on another disk, big enough to store the image. conv=noerror will ignore disk read errors if you get any.

If you prefer to store the image remotely - check out https://twindb.com/take-image-from-corrupted-hard-drive/ , it describes more options.

Then download and compile Undrop-for-InnoDB.
Then follow steps from tutorial:

You need to find InnoDB pages on the image. The stream_parsertool does it:

./stream_parser -f /path/on/sda/faulty_disk.img


The result of the tool will be a directory pages-faulty_disk.img that contains InnoDB pages sorted by page type and index_id. InnoDB stores tables in indexes. The table itself is stored in the PRIMARY index, secondary indexes are stored separately. To recover the data we need to fetch records from PRIMARY indexes. Now, InnoDB identifies indexes by index_id while we, humans, know table names. To find index_id for each table you will need to restore InnoDB dictionary first. You can check the blog post or script recover_dictionary.sh from the undrop-for-innodb toolkit. 

Now, let's say you found index_id for each table and there is a respective index file in pages-faulty_disk.img/FIL_PAGE_INDEX/&lt;index_id&gt;.page. 

To extract records from the index you need to know the table schema, because InnoDB doesn't store the schema in the index. I hope you have the schema either from old backups, or maybe from the installation script. Worst case you can try to restore the schema from InnoDB dictionary.

When you have the schema and index_id you can generate text dumps from the index.

./c_parser -6f pages-faulty_disk.img/FIL_PAGE_INDEX/0000000000000015.page -t sakila/actor.sql &gt; dumps/default/actor 2&gt; dumps/default/actor_load.sql


Obviously, sakila.actor is just an example.
Then review the text dump dumps/default/actor and you can load it with an SQL command stored in dumps/default/actor.sql.
The tool's page also refers to some other tutorials which may be useful. Data recovery is quite unpredictable so you have to get familiar with the tool and process.

Hope this helps.