Introduction
Human mistakes are inevitable. Wrong “DROP DATABASE” or “DROP
TABLE” may destroy critical data on the MySQL server. Backups
would help however they’re not always available. This situation
is frightening but not hopeless. In many cases it is possible to
recover almost all the data that was in the database or
table.
Let’s look how we can do it. The recovery plan depends on whether
InnoDB kept all data in a single ibdata1 or each table had its
own tablespace . In this post we will consider the case
innodb_file_per_table=OFF. This option assumes
that all tables are stored in a common file, usually located at
/var/lib/mysql/ibdata1.
Wrong action – table deletion
For our scenario we will use test database sakila that is shipped
together with the tool.
Suppose we drop my mistake table actor:
mysql> SELECT * FROM actor LIMIT 10; …[Read more]