By Unknown | 0 comment

Restore MySQL database from .frm files


So you need to restore a MySQL database from the files which were on a server and don’t have a proper SQL dump which you can just easily import, d’oh!
Below is a brief example from a WAMP server of how this can be done.
Before starting you should stop the WAMP services, or at least restart the services when prompted to start them.
On the old server instance navigate to the MySQL data folder by default this should look something similar to “C:\wamp\bin\mysql\mysql5.1.53\data\” where “mysql5.1.53″ will be the version number of the previously installed MySQL database.
Inside this folder you should see a few files and folders. The folders are the actual MySQL databases, and contain a bunch of .frm files which we will require. You should recognise the folder names as the database names. These folder and all their contents can be copied directly to your MySQL data folder, you can neglect the default databases mysql, performance_schema, test.
If you started the server now you will see the databases are picked up, however the databases will contain none of the tables which were copied across. In order for the contents of the database to be picked up, back in the data folder you should see a file “ibdata1″, this is the data file for tables, copy this directly into the data folder, you should already have a file in your new data folder called “ibdata1″ so you may wish to rename this to “ibdata1.bak” before copying across the “ibdata1″ from the old MySQL data folder.
Once this has been done Restart all the WAMP services. You can use PhpMyAdmin to check if your databases have been successfully restored.

0 comment: