/ by Oliver Pugh

Reinstalling WordPress With Only Site Files and a Database Backup

It happens to the best of us. Something goes wrong with an automated backup. Your WordPress Website become corrupted or is lost completely. And your last resort is to restore from the files and database which hopefully are not too old. When this happens, you need to get your site back up as fast as possible. We’ll walk through how to restore your website without the help of a tool like cPanel.

If you haven’t already do yourself a favor and install one of an abundance of WordPress backup plugins that will make restoring your site in the event of a crash, much easier and much faster. For manual backups, we like the free plugin All-in-One WP Migration. This tool is not only useful for manually backing up your site to a number of locations but also our pick for migrating WordPress sites from one environment to another. For automated backups, most of the reliable plugins are paid but they are well worth the investment. Check out BackupBuddy to help schedule automated backups and give you that extra peace of mind.

There are a few prerequisites before we get started. Take a moment to make sure you have all of this information readily as you’ll need all of it during this process.

Pre-Requisites

  • A fresh install of WordPress on any hosting platform. (Need a new WordPress environment? Ask us how we can help.)
  • FTP access to a fresh install of WordPress.
  • phpMyAdmin access to the new WordPress database.
  • All site files where the three main directories include wp-admin, wp-content, and wp-includes.
  • Database backup file saved as either compressed (.gzip, .zip) or uncompressed.

Step 1 – Verify your WordPress is installed on your new website

Navigate to the domain and location of the new wordpress install. You should see either the WordPress Language selection tool or a default theme. If you this setup screen with the language selection, complete that setup first so that you have the required database access information noted above.

Step 2 – Deleting Files via FTP

Connect to your new WordPress website via FTP using a tool like FileZilla. That’s the FTP client we’ll use for this demonstration. At a minimum, you’ll need the following information to connect, however in some cases FTP connections require different information. Please contact your hosting provider or network administrator if you have questions on how to access your WordPress website via FTP. 

hostname = ip address of your website or a FQDN. (e.g. 123.45.678.910 or ftp.somesitename.com)
username
password
port number (most commonly 21 for ftp and 22 for sftp)

Enter this information into Filezilla and connect via FTP. 

Next, we’ll navigate in the remote site to the root WordPress directory. When there, you’ll see a few files along with the directories wp-admin, wp-content, and wp-includes.

We’ll now delete all of these files. Select all of the files and directories in the remote site, then right click and delete. Click yes to confirm. The deletion process shouldn’t take too long depending on how many source files were part of the new site.

Step 3 – Delete Database Contents

Next, we’ll delete the database contents of the new WordPress site. We’ll need to use phpMyAdmin to do this. Navigate to your website phpMyAdmin login page and use the database credentials to login. Once in, you’ll find the WordPress database (note: you database name is unique to you so look for the name of the database when it was setup).

Click on the database name.

Doing this should open the Structure tab but if it doesn’t, click on that tab next. At the bottom of the right pane you’ll see the option for ‘Check All’. Select this option and in the dropdown (some cases an icon), select ‘Drop’. Dropping the tables will clear all information stored in the database, giving us a clean slate to start from.

It will ask you to confirm if you want to drop the tables, so click ‘Yes’ now.

Step 4 – Upload Site Files via FTP

Depending on how large your site was (unoptimized image content can take up a lot of unnecessary space), this next step may take a while. Back in the FTP connection where we just deleted all the site files, we will now upload the old site files. Select everything in your local host and copy (right click > upload) the files and directories back into the root WordPress directory.

For your enjoyment while you wait…. Google Garden Gnomes

 

Step 5 – Update wp-config.php for New Database Settings

In some cases, if you were able to reuse your original host settings and didn’t change your database name or password from the setting in the backup database, your site might be ready to go. However, most people either don’t remember what those were named or didn’t rename them the same way, which is okay. In your FTP client, find the wp-config.php file in the remote site and download it to your desktop. Open it will a text or code editor and navigate to the section called // ** MySQL settings ** //. Here you will update the database name, user, password and host to match your new WordPress site. It should look something like this.


// ** MySQL settings ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'changeMEplease' );

/** MySQL database username */
define( 'DB_USER', 'changeMEplease' );

/** MySQL database password */
define( 'DB_PASSWORD', 'changeMEplease' );

/** MySQL hostname */
define( 'DB_HOST', 'changeMEplease' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

Save this file. In your FTP client, refresh the files and upload the wp-config.php file back into the remote site with the updated settings.

Step 6 – Open Your Website in a Browser

With most all of the settings restored, navigate back to your website. You will see the WordPress setup installation screen with the url /wp-admin/install.php. STOP HERE!

If you proceed with the setup, you’ll overwrite your site and have to start over again.

 

Step 7 – Import Database from Backup

Let’s head back over to phpMyAdmin. With the WordPress database selected, click on the Import tab at the top of the screen. Choose your database backup file and click Go.

This will import your database back into your site.

 

Step 8 – Finish Import

Go back to your browser and delete the /wp-admin/install.php from the url and click enter. Your website is now restored and you’re ready to start using it again.

Hope this helped you get through the process of reinstalling WordPress with only site files and a database backup. If you still need help restoring your website, please contact our team for assistance.

Leave a Reply