Restore MySQL Database with only .frm files

Posted on

Question :

One of our servers (running Ubuntu 12.04) recently crashed during a power outage, and MySQL refused to start back up. After a lot of trial and error, I decided to completely reinstall it. Since I wasn’t able to start any of the services, I couldn’t do a dump, and there were no backups before that. I only have a copy of /var/lib/mysql.

Some databases have .MYD and .MYI files for all tables in the directory, so I was able to restore them fine by just copying the files. However, others only have the .frm files, and db.opt. There are no other files. I tried to stop the server, copy ibdata1 and ib_logfile1 and 2 from the backup directory and start it up again, but that always makes it crash again until I overwrite them with the fresh files.


  • Databases all show up with show databases
  • Tables all show up with show tables, but they’re not listed in information_schema.TABLES.

There is some important data in the tables that aren’t being recognized, and I’m really at a loss now. Is there any way to restore them?

Edit: The error log says this:

InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 5. 
InnoDB: You may have to recover from a backup. 
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the 
InnoDB: error. 
InnoDB: If the corrupt page is an index page 
InnoDB: you can also try to fix the corruption 
InnoDB: by dumping, dropping, and reimporting 
InnoDB: the corrupt table. You can use CHECK 
InnoDB: TABLE to scan your table for corruption. 
InnoDB: See also 
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page. 150921 12:17:58  
InnoDB: Assertion failure in thread 3064645376 in file buf0buf.c line 3623
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: about forcing recovery. 10:17:58 UTC - mysqld got signal 6 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. We will try our best to scrape up some info that will hopefully help diagnose the problem, but since we have already crashed,  something is definitely wrong and this may fail.
It is possible that mysqld could use up to  key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346076 K  bytes of memory Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... 
stack_bottom = 0 
thread_stack 0x30000
/usr/sbin/mysqld(handle_fatal_signal+0x484)[0xb7174ce4] [0xb6e26404] 
/usr/sbin/mysqld(+0x58b708)[0xb73d4708] /usr/sbin/mysqld(+0x58c0e2)[0xb73d50e2] 
The manual page at contains information that should help you find out what is causing the crash.

Unfortunately, restarting the OS did not solve the problem, and by that time MySQL was already not starting up anymore.

Answer :

Try again but rename ib_logfile0 to ib_logfile0_old ib_logfile1 to ib_logfile1_old. These file automatically created from ibdata file when mysql server restart.

Try innodb_force_recovery option- mysql

innodb_force_recovery = 1

If is not solving and i suggest to use recovery tool.
Twindb and Percona

Leave a Reply

Your email address will not be published. Required fields are marked *