A challenge : Taking backup of mysql database from Data folder

A challenge : Taking backup of mysql database from Data folder

You are given a Data folder from some of old mysql servers and asked to recover that database , now what to do ?

You find xyz named project folder in data folder ibdata1 file, log files , error files and mysql folder.

If you replace your data folder with this folder you will not be able to connect to that database , as you dont have information about what username and password to be used to connect this database.

Stuck up ...? Google out ...No Help... ?

Here is the tricky solution ... :)
Locate your data folder in mysql ex. in wamp its located here C:\wamp\bin\mysql\mysql5.1.36\data


1) Stop your mysql server
 

2) For Inno DB database put tha backup of your ibdata1 file and replace it with the one which have to be backed up ibdata1 is the data file for tables stored using the InnoDB engine.
 

3) Put the XYZ named folder from the provided data folder in this folder , this xyz will actually is your database name The simple concept here is not to forget that mysql stores entire database in files ,
    .MYI = mysql index Files
    .MYD = mysql data file
    .FRM = table format (Schema)
 

4) Restart your mysql server , try to check that database with PHPMyadmin , you will find that you all previous databases listed there but they wont be having their data in them , but the new database that you are trying to import has been successfully imported with all the data inside it. Now take the sql backup of it
 

5) Stop mysql Recover back you original ibdata1 file , remove the xyz folder from data directory , restart mysql connect back and check if all your previous databases are proper with entire data in them , n now you have sql file
with you , just create a database and import sql file and you are done.

Be careful with all aboves steps , dont forget to take the backup of folder before doing this operation.

Cheerz

Comments