How to restore only the database from a backup

In cPanel, open JetBackup 5 (Files section), pick the day, and restore only the one database, leaving the files and the e-mail alone. A restore replaces the current database with the one from that day. When you cannot afford to lose what came in afterwards (orders, comments), there is a second road: download the copy and import it into a scratch database, to fetch only what is missing.

The two roads

Restore Download and import separately
What it does Puts the database back as it was that day, over the current one. Gives you the file; you create a new database and import it there. The current one is untouched.
When to use it The database is broken or wiped and nothing that came in afterwards matters. You want one table, one record or a few orders back without erasing the rest.
Risk You lose everything that changed since that date. More work, and it is easy to point the site at the wrong database.

Road 1: restore the database

1 Find out which database it is. An account with several sites has several. In WordPress it is in wp-config.php, on the DB_NAME line (see finding out which database this WordPress uses).
2 Save the current state first. Export the database with phpMyAdmin (exporting a database). If the old copy turns out worse, you can still go back to where you started.
3 In JetBackup, pick the day. Not the newest out of habit: the last one before the problem. Questions about the date are in restoring without opening a ticket.
4 Choose the databases entry and tick only the one you want. Confirm and follow the task in the Queue.
5 Clear the caches and test. Open the site in a private window, sign in to the site’s dashboard and check a page, the most recent order the copy still holds, and the contact form.

Road 2: download and fetch only what is missing

1 Download the database copy in JetBackup instead of restoring it. You get a file with the SQL, which may be compressed.
2 Create a new, empty database under MySQL Databases, with its own user and privileges (creating the user and the privileges). The name carries the account name in front.
3 Import the SQL into that new database. Through phpMyAdmin (importing with phpMyAdmin and the size limit) or over SSH if it is big (importing a large database over SSH).
4 Compare, and bring back only what you need. In phpMyAdmin, open the table in the scratch database, export just that table and import it into the real one, or copy the missing rows. If the table links to others (orders and order lines), bring them together.
5 Delete the scratch database when you finish. It holds your customers’ data and nobody will keep it up to date.
In a shop, do not restore a database that is days old. It erases those days’ orders, and the money and the goods have already moved. Use road 2: import separately and recover only what was lost.
In WordPress, do not restore loose tables by guesswork. Posts, options and metadata are tied together: putting back only one of them leaves the rest inconsistent. Restore the whole set of the site’s tables, or bring only the ones you know are independent.
Files newer than the database? If you updated a plugin after the copy’s date, the old database may lack the tables the new plugin expects, and WordPress asks to “update the database”. Let it, or restore the files from the same day as well. See restoring with JetBackup.

Not sure which day to pick, or the restore is stuck in the queue? Tell us the domain and what happened.

Open a support ticket

SEE ALSO

Restoring a backup yourself, without opening a ticket

Exporting a database with phpMyAdmin

Backing up with mysqldump and pg_dump, and restoring the copy

Moving a database to another account or server

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?