List:General Discussion« Previous MessageNext Message »
From:Keith Keller Date:June 9 2012 1:29am
Subject:Re: Emergency backup from *.frm *.MYD *.MYI files
View as plain text  
On 2012-06-09, Miguel Cardenas <renito73@stripped> wrote:
>
> My linux system died due a bad system driver and it does not boot
> ANYMORE, I am backing up my data files to restore a previous worlking
> backup of the whole system that DOES NOT INCLUDE THE DATABASES...

I hope you will be correcting that in the future!

> I'm still backing up and will take some time before restore the
> system, in the mean time I want to know if I can restore the databases
> from the *.frm *.MYD and *.MYI files, maybe creating the databases
> again and replace them with the old data files?

If they are MyISAM tables, then you should be able to restore most of
your tables in this fashion.  It depends on how often these tables are
written to; if they get writes very frequently then they may be too
inconsistent to recover.  The basic process is to create the directory
(either with CREATE DATABASE or directly on the filesystem; make sure
the mysql user can write the directory), then copy the files in to the
directory (make sure nobody is doing any writes to the db during this
process, and make sure the files are owned by the mysql user when done).

This is basically how mysqlhotcopy works--it locks the tables, then
copies the raw files to the destination.  Your only potential problem is
that the tables were open at the time, so changes might not have been
written before your crash.

Once you have copied the needed files, you should run myisamchk (make
sure mysqld is *not* running) on the *.MYI files.

--keith

-- 
kkeller@stripped


Thread
Emergency backup from *.frm *.MYD *.MYI filesMiguel Cardenas9 Jun
  • Re: Emergency backup from *.frm *.MYD *.MYI filesKeith Keller9 Jun
    • Re: Emergency backup from *.frm *.MYD *.MYI filesReindl Harald9 Jun