Learn how to back up a WordPress website, restore website data,
migrate a website to another server, and move a local WordPress
project to a live hosting environment.
Learning Objectives:
After completing this lesson, you will understand website
backups, database exports, file backups, restoration,
migration procedures, and common migration problems.
1. What Is a WordPress Backup?
A backup is a separate copy of your website files and database.
It helps you recover your website if files are accidentally
deleted, an update fails, a website is hacked, or a server
develops a problem.
File Backup
A file backup may include:
WordPress core files
Theme files
Plugin files
Uploaded images and documents
Configuration and custom code
Database Backup
The database usually stores:
Posts and pages
Users and user information
Website settings
Comments
Plugin and theme data stored in the database
Remember:
A complete backup normally requires both the website files and
the database. Some settings and important customizations may
also exist outside the database, so review your site's specific
requirements.
2. Why Are Backups Important?
Regular backups help you:
Recover from accidental file deletion.
Restore a website after a failed update.
Recover from certain malware or security incidents.
Move a website to a new hosting provider.
Recover data after a server failure.
Test changes before deploying them to a live website.
3. Types of WordPress Backups
Backup Type
Description
Example Use
Full Backup
Copies all required website files and database data.
Complete website recovery.
Database Backup
Copies database tables and stored content.
Recovering posts and settings.
File Backup
Copies website files and media.
Recovering themes, plugins, and uploads.
Incremental Backup
Saves changes made since a previous backup.
Reducing backup storage and processing.
Scheduled Backup
Runs automatically on a configured schedule.
Daily or weekly backup routines.
4. Create a Database Backup Using phpMyAdmin
phpMyAdmin is a browser-based tool for managing MySQL and
MariaDB databases. Many hosting providers include it in their
hosting control panels.
Database Export Steps
Log in to your hosting control panel.
Open phpMyAdmin.
Select the database used by WordPress.
Click the Export tab.
Select the Quick export method for a straightforward export.
Choose SQL as the format.
Click Export or Go, depending on the interface.
Save the downloaded SQL file in a secure location.
Example backup filename:
wordpress_database_backup.sql
Keep database backups private. They can contain personal
information, user details, and other sensitive website data.
5. Create a File Backup
You can back up WordPress files using your hosting file manager,
an SFTP client, or a backup tool supplied by your hosting provider.
File Backup Steps
Open the hosting file manager or connect through SFTP.
Locate the WordPress installation directory.
Identify the files and folders required by your website.
Include wp-content, configuration files, and any required custom files.
Include the rest of the installation files if making a full file backup.
Download or archive the files.
Store the backup securely outside the public website directory.
Important WordPress paths include:
wp-admin/
wp-includes/
wp-content/
wp-config.php
The wp-content directory normally contains themes,
plugins, and uploaded media. The wp-config.php file
contains database connection details and other configuration.
Protect it carefully.
6. Use a Backup Plugin
WordPress backup plugins can simplify scheduled backups and
restoration. Features differ between plugins and their free
or paid versions.
Common Backup Plugin Features
Schedule database and file backups.
Save backups to supported remote storage.
Download backup archives.
Restore supported backup sets.
Manage backup retention and storage.
To install a backup plugin:
Open Plugins > Add New Plugin.
Search for a reputable WordPress backup plugin.
Review its documentation, compatibility, and storage requirements.
Click Install Now.
Click Activate.
Configure the backup schedule and storage location.
Create a backup and verify that it completed successfully.
7. What Is WordPress Migration?
WordPress migration means moving a WordPress website from one
location or environment to another.
Common Migration Types
Localhost to live hosting
One hosting provider to another
One domain to another
Subdomain to main domain
HTTP to HTTPS
Live website to staging environment
Migration Requirements
Website files
Database export
Destination database and credentials
Compatible PHP and database versions
Correct domain and URL configuration
A backup and testing plan
8. Migrate WordPress Manually
A manual migration requires transferring the website files and
database, configuring the destination environment, and checking
the website after the move.
Manual Migration Procedure
Back up the original website files and database.
Create a database and database user on the destination server.
Grant the required database privileges.
Upload the WordPress files to the destination.
Import the SQL backup into the destination database.
Update the destination wp-config.php with the new database details.
Update the site's domain or URL references when required.
Configure DNS and HTTPS when moving to a live domain.
Test the migrated website before completing the move.
9. Configure wp-config.php
The wp-config.php file connects WordPress to the
database. During migration, database names, usernames, passwords,
or host details may change.
This is an example only. Replace the placeholder values with
the actual credentials supplied by your hosting provider.
Never share real database passwords in public code or screenshots.
10. Import a Database Using phpMyAdmin
To import a database backup:
Open phpMyAdmin on the destination server.
Select the destination database.
Click the Import tab.
Select your SQL backup file.
Choose the appropriate import settings and format.
Start the import.
Check for errors and confirm that the expected tables exist.
For a large database, use an import method supported by your
hosting provider if phpMyAdmin's upload or execution limits
prevent the import.
11. Update Website URLs After Migration
If a website moves to a different domain, its database may still
contain references to the old domain. These references can affect
links, images, menus, and other settings.
Example:
Old URL:
http://localhost/mywebsite
New URL:
https://example.com
Replace these example URLs with the actual source and destination
URLs for your website.
Important:
WordPress data can contain serialized values. Do not blindly run
a basic SQL text replacement across the entire database.
Use a WordPress-aware search-and-replace tool or a migration
solution that correctly handles serialized data. Keep a backup
before changing URLs.
12. Migrate WordPress from Localhost to Live Hosting
Developers often create WordPress websites locally before
publishing them online.
Localhost to Live Website
Local WordPress Website
Develop and test the website locally.
Backup Files + Database
Transfer and Configure
Live WordPress Website
Import, configure, secure, and test.
Follow these general steps:
Finish and test the local website.
Export the local database.
Back up the local WordPress files.
Prepare hosting, a database, and a domain.
Upload the files and import the database.
Update database credentials and URLs as necessary.
Configure HTTPS and verify DNS.
Test links, images, forms, logins, and important features.
13. Common Migration Problems
Problem
Possible Cause
What to Check
Error establishing a database connection
Incorrect database credentials or unavailable database server.
Database name, username, password, host, and privileges.
404 errors
Permalink or rewrite configuration problems.
Save Permalinks settings and review server rewrite rules.
Missing images
Files were not transferred or old URLs remain.
Uploads directory and image URLs.
Redirect to old domain
Old URL settings or redirect rules remain.
WordPress URLs, database references, and server redirects.
Blank page or HTTP 500 error
PHP error, incompatible plugin, or server configuration issue.
Server error logs, PHP compatibility, and plugin/theme issues.
Mixed-content warning
Some resources still load over HTTP.
Image, script, stylesheet, and other resource URLs.
14. Best Practices for Backup and Migration
Recommended Practices
Create a backup before changing files, domains, or databases.
Store backups separately from the production website.
Protect backup files with appropriate access controls.
Test restoration instead of assuming a backup works.
Use a staging site for complex migrations when possible.
Check PHP and database compatibility.
Use secure transfer methods such as SFTP.
Test the destination before switching live traffic.
Keep the original backup until migration is verified.
Plan how to recover if the migration fails.
15. Practical Assignment
Your Task
Create a backup of a test WordPress website.
Export its database using phpMyAdmin.
Download or archive the WordPress files.
Identify the database credentials in the test site's configuration without sharing them.
Prepare a separate test installation or staging environment.
Restore the backup in that environment, following the appropriate migration steps.
Check the homepage, images, pages, menus, and admin login.
Write down any migration errors and how you resolved them.
16. Lesson Summary
A complete WordPress backup usually includes files and database data.
phpMyAdmin can export and import SQL database backups.
Website files can be copied using a hosting file manager or SFTP.
Migration requires correct database credentials and destination configuration.
Domain changes may require WordPress-aware URL replacement.
Test the migrated website before switching all visitors to it.
Keep backups secure and verify that restoration works.