We‘ve all been there – that sinking feeling when you realize something has gone terribly wrong with your WordPress site. Maybe it was hacked, or an update broke things, or your server crashed. Whatever the reason, if you find yourself with just a database backup, don‘t despair! While it‘s not ideal, you can still recover most of your site.
In this guide, we‘ll walk through the process of restoring a WordPress site using only a database backup. It will take some work, but by following these steps carefully, you can minimize data loss and get back online faster.
Understanding WordPress Backups
Before we dive into the restore process, let‘s talk about WordPress backups. WordPress sites have two main components:
- The database (where your content, settings, and user info are stored)
- The files (WordPress core, plugins, themes, uploads)
Ideally, you should have complete backups that include both the database and all the files. But if you only have a database backup, that means you‘re missing the second part of the equation.
According to a recent survey, over 60% of WordPress sites don‘t have complete backups. And of those that do have backups, 45% never test them. That‘s a recipe for disaster.
| Backup Type | Has Database | Has Files |
|---|---|---|
| Database only | ✓ | ✗ |
| Files only | ✗ | ✓ |
| Complete (recommended) | ✓ | ✓ |
Without a complete backup, you‘re at risk of losing crucial data if something goes wrong. The WordPress Codex strongly recommends automated, regular, complete backups as a best practice.
Preparing for the Database Restore
Okay, so you‘ve found yourself with only a database backup in hand. Take a deep breath – we‘ll get through this together. The first step is to set up a fresh WordPress install to act as a container for your database.
Here‘s what you need to do:
Download a fresh copy of WordPress from wordpress.org. Make sure it‘s the same version your site was using.
Unzip the files and upload them to your server via FTP. I recommend using FileZilla, a free FTP client.
Create a new database for this install through your hosting panel (usually cPanel or Plesk). Note the database name, username, and password.
Rename
wp-config-sample.phptowp-config.phpand edit it with your new database details.Run the WordPress installer by visiting your domain. Complete the famous 5-minute install.
Now you have a squeaky clean WordPress install connected to a brand new database. It won‘t have any of your old content yet – that‘s what we‘ll import next.
Importing Your Database Backup
With your fresh WordPress install ready, it‘s time to import your backed up database. The easiest method is via phpMyAdmin, a database admin tool that comes with most hosting plans.
Log into your hosting panel and open phpMyAdmin.
Select your new WordPress database from the left sidebar.
Click the "Import" tab at the top.
Choose your database backup file (usually a .sql) and click "Go."

Depending on the size of your database, the import could take anywhere from a few seconds to several minutes. If your backup is very large, you may need to use an alternate method like WP-CLI or BigDump.
Once the import finishes, your old database tables will replace the default ones in the new database. But you‘re not done yet!
Reconfiguring WordPress
Even though your database is now restored, WordPress is still configured to use the temporary database from the fresh install. We need to tell it to use the newly imported database instead.
Connect to your server via FTP and download
wp-config.php.Open it in a text editor and find these lines:
define( ‘DB_NAME‘, ‘temporary_db_name‘ );
define( ‘DB_USER‘, ‘temporary_db_user‘ );
define( ‘DB_PASSWORD‘, ‘temporary_db_pass‘ );Replace the temporary values with your new database name, user, and password. These should match what you used when importing your backup.
Save the file and re-upload it to your server.
Visit your site and hopefully you‘ll see a close approximation of your old site!
But we‘re not out of the woods just yet. Since you only restored the database, you‘re still missing themes, plugins, and uploads.
Recovering Your Themes and Plugins
WordPress stores your content in the database, but themes and plugins live in separate files. To get your site looking and functioning like it used to, you‘ll need to reinstall them.
For themes:
Identify which theme you were using before. Check your database backup for the
wp_optionstable and look for thetemplateandstylesheetvalues.Download a fresh copy of the theme, either from WordPress.org or from your theme provider.
Unzip the files and upload them to
/wp-content/themes/on your server.Go to Appearance > Themes and activate your theme.
Unfortunately, you‘ll lose any customizations that were made directly to the theme files. Use the WordPress Customizer or your theme options to reconfigure things as best as possible.
Plugins are similar:
Make a list of which plugins you need and find the download files, either from WordPress.org or premium marketplaces like CodeCanyon or your plugin developer.
Upload the plugins to
/wp-content/plugins/and activate them one by one from the Plugins screen in your WordPress admin.Visit each plugin‘s settings page and reconfigure options as needed. Some may require premium license keys to be entered again.
If you had custom code snippets, you‘ll need to re-add those to your theme‘s functions.php or via a plugin.
Finding Your Lost Images and Uploads
The trickiest part of a partial database restore is recovering your lost media uploads. Unfortunately, those files are not included in the database and are the hardest to recover. But don‘t lose hope yet!
The first place to look is your own local backups. If you keep your site files backed up to a service like Dropbox or on your computer, check there for your /wp-content/uploads/ folder.
If you come up empty locally, try the Internet Archive‘s Wayback Machine. Enter your site URL and see if they have snapshots of your pages with images intact. You can right-click and save individual images.

Next, turn to Google. Use the site search operator (e.g. site:yoursite.com) in Google Images to find images that were indexed from your domain. You may also have some luck with the image URL search extension for Chrome.
If you strike out on Google, there are a few WordPress plugins that can help locate missing images and fix broken links:
- Velvet Blues Update URLs – update image URLs site-wide
- Media Deduper – remove duplicate images
- Regenerate Thumbnails – rebuild thumbnail images in bulk
As an absolute last resort, you may need to manually replace missing images. This is time-consuming but can be worth it for critical content.
Last Steps and Best Practices
Once you‘ve restored as much as possible, take the following steps to verify and protect your site:
- Manually review important pages to check for missing content or broken links.
- Run a security scan with a plugin like Wordfence to check for malware.
- Generate new secure passwords for all users, especially admins.
- Create a new full backup of your restored site.
- Set up a reliable automated backup solution going forward – UpdraftPlus, BackupBuddy, and Jetpack Backup are all great options.
- Store backups securely offsite in the cloud or on external drives.
- Test your backups regularly to ensure you can restore when needed.
Remember, the best protection is preparation. With complete backups, you‘ll never again have to go through the pain of a partial restore.
You‘ve now gone through a trial by fire and learned a lot about WordPress under the hood. Pat yourself on the back for piecing your site back together! Going forward, make sure you‘re always prepared for the unexpected with a robust backup strategy.
