Restoring MySQL database from physical files

Abdullah Jibaly picture Abdullah Jibaly · Jan 27, 2009 · Viewed 254k times · Source

Is it possible to restore a MySQL database from the physical database files. I have a directory that has the following file types:

client.frm
client.MYD
client.MYI

but for about 20 more tables.

I usually use mysqldump or a similar tool to get everything in 1 SQL file so what is the way to deal with these types of files?

Answer

Vincent picture Vincent · Jan 27, 2009

A MySQL MyISAM table is the combination of three files:

  • The FRM file is the table definition.
  • The MYD file is where the actual data is stored.
  • The MYI file is where the indexes created on the table are stored.

You should be able to restore by copying them in your database folder (In linux, the default location is /var/lib/mysql/)

You should do it while the server is not running.