Getting one record back.
THE SITUATION
One post, one order, one customer deleted in error. The rest of the database is current and correct.
WHAT NOT TO DO
Restore the whole database. That loses everything since the backup to recover one row.
THE CORRECT APPROACH
- Create a temporary database.
- Import your backup into it.
- Find the row you need.
- Copy it into the live database.
- Remove the temporary database.
FINDING IT
Browse or search the relevant table in the temporary database.
COPYING IT
phpMyAdmin can export a single row as an INSERT statement. Run that against the live database.
Check first that the id is not already in use.
THE RELATED DATA
Content rarely lives in one row. A post has metadata, term relationships and possibly comments.
Recover those too, or the restored row is incomplete.
For WordPress, the post row plus its postmeta rows plus its term relationships.
CHECKING THE APPLICATION'S TRASH FIRST
Many applications keep deleted items for a period. Check there before anything else.