Mysql data backup restore from corrupted system

Get mysql datafiles and restore on new system.

http://stackoverflow.com/questions/10680261/restore-mysql-database-folder-from-a-recovered-hard-disk

1:: Find Data Folder of mysql server
You can try this-in All programm=> MySql Server => open CMD

mysql> select @@datadir;

ex:: C:\ProgramData\MySQL\MySQL ser 5.1\Data\

2::

Go over to the target computer, Open System Services.
(Type services.msc at the Windows menu “Search Program and files” entry box

3::

On the right panel of the Services window, scroll along the list and look for the name “MYSQL“.
Select MYSQL and right mouse click and click . Once it has stopped, you will it’s status become blank instead of .

4::
Similarly look for the location of the data folder. Once you located it,
I recommend you back up the folder or just rename it.
Paste over the folders and ibdata file you have copied from the source computer to the data folder.

5::
Go back to the Services window and select back MYSQL.
Right mouse click on it and click to resume the MYSQL service.

6::
Open MYSQL administrator and log on to your database
server and you should be able to see your transferred database together with their data.

Advertisements

One thought on “Mysql data backup restore from corrupted system

  1. The MySQL server at both the machines MUST be stopped. Of course if the OS/hard disk crashed, the server at that machine is already stopped.
    Now, MySQL installation is in 2 folders (for me at least) ->
    1. Program Files / Program Files (x86), and
    2. C:\Program Data\MySQL in windows 7 and C:\Users\All users\Application Data\MySQL in Windows XP. Note that Program Data(win7) as well as Application Data(WinXP) are hidden folders.
    We are ONLY CONCERNED with the MySQL Server ** folder in the Application Data or Program Data folders. The Mysql folder in Program Files is of no use as it does not have your data.
    Now Copy the my.ini file in MySQL Server ** folder.
    Open the data folder and copy these files
    1. All the ib_logfile* files
    2. All the ibdata* files
    3. The database folders (that you want) containing .frm and .ibd files
    Now, copy the files mentioned in the above two points in the destination machine. It is highly recommended to take a backup of the replaced files in the destination machine.
    Now, restart the server. If you went right, you would restore your databases without any error.

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s