Manually Backup and Restore WordPress To New VPS

In this tutorial I’m going to show you how to manually download your WordPress Database and content and put everything on a new server. This is the perfect tutorial if you’re changing hosting providers and want a manual approach to the process. Using Plugins can cause their own set of headaches and knowing this process will enhance your web admin skills. The process is easy and a skilled admin will have this done in 20 minutes depending on the amount of data which needs transferring.

Although this tutorial is geared towards VPS users, users with hosting providers have similar tools available to complete the job. Anyone with access to FTP credentials and a CPanel can follow this tutorial. Hosting companies worth their salt will provide a Cpanel or something comparable.

**Note After this process is complete be sure to update your DNS A records to point to the new server.**

Exporting MySQL Database

The first order of business is backing up your MySQL database. The Database holds most of the crucial information and content related to the site. On a VPS this is easily done via PhpMyAdmin. PhpMyAdmin is available through your hosting providers Cpanel. If you are running a VPS such as an Ubuntu server, PhpMyAdmin is easily installed with the following command:

apt-get install phpmyadmin

Login to the PhpMyAdmin interface:

phpmyadmin login interface
Logging in to PhpMyAdmin

From here select the database you want to export. If you’re unsure of what database to select, check the wp-config.php file at the root of your WordPress installation on the server. This file will provide you with the username, password, and database name of the site. Once exported you have an SQL file containing the entire database. This same file will be used later in the import process.

Selecting the database we want to export
Selecting the database we want to export

Select Export:

phpmyadmin export database
Exporting the database

Now you want to download the WordPress files. The WordPress files contain certain content like images and configuration files necessary for the overall functioning of WordPress. This is easily done through software such as FileZilla or WinSCP. For this example I will use WinSCP since I have SSH access to the server but this can also be done with FileZilla in the case of FTP. SSH is a much more secure method of transferring files to and from the server and recommended over FTP.

Use your remote login credentials and navigate to the root folder of the website and download all the WordPress files:

win scp download
Downloading the WordPress files off the original server with WinSCP

With the SQL database and WordPress files you can now configure the new server.

Setup New Server

First ensure the appropriate software is installed on the VPS. At the bare minimum you need the latest version of Apache, PHP, MySql, and PhpMyAdmin. Many VPS companies offer one click installations of these services but they can also be manually installed.

The LAMP Stack is easily installed on Ubuntu systems with the following commands:

apt-get install apache2

apt-get intsall mysql-server

apt-get install php7.2 libapache2-mod-php7.2 php-mysql

apt-get install phpmyadmin 

Creating The New WordPress Database

Now you must create the new database and import the the SQL file you downloaded from the old server. Keep all the credentials the same if you don’t want to edit your wp-config.php file.

Login to PhpMyAdmin with the credentials you specified during the MySQL server installation and create the database:

Create the database:

phpmyadmin create database

Import the SQL file you downloaded from the original server:

phpmyadmin import database

That’s all you need to do as far as the database is concerned.

Uploading WordPress Files To Server

Using your preferred file transfer method upload all the original files from the old server to the root www directory.

You should now be able to successfully login to WordPress on the new server.

Troubleshooting

Most common issues are troubles connecting to the database. Ensure the database credentials match those found in your wp-config.php file. Also be sure to redirect your DNS records to the new server.

Leave a Comment