XAMPP Backup and Recovery

Backing Up a XAMPP Project

A XAMPP project usually consists of two parts:

  1. The website files stored in the htdocs folder.
  2. The MySQL database storing the application's data.

To create a complete backup, both parts must be saved.


Create a Backup Folder

Create a folder somewhere safe, such as:

OneDrive - Department of Education
└── XAMPP Backups

Inside it create:

XAMPP Backups
├── Website Files
└── Databases

Back Up the Website Files

Open the XAMPP installation folder.

Example:

C:\xampp\htdocs\

Locate your project folder.

Example:

C:\xampp\htdocs\security_dashboard

Copy the entire project folder into:

XAMPP Backups
└── Website Files

Your backup should now contain:

Website Files
└── security_dashboard

This backup includes:

Open phpMyAdmin

Open phpMyAdmin in your browser.

Example:

http://localhost/phpmyadmin/

Select the database used by your project.

Example:

project_db

Export the Database

Click:

Export

Choose:

Method: Quick
Format: SQL

Click:

Export

A file similar to the following will be downloaded:

project_db.sql

Save the Database Backup

Move the downloaded SQL file into:

XAMPP Backups
└── Databases

Your backup folder should now contain:

XAMPP Backups
├── Website Files
│   └── security_dashboard
│
└── Databases
    └── project_db.sql

Test the Backup

Before making major changes to a project, check that:

A backup is only useful if it can be restored.


Complete Backup Checklist

Website Files

✔ Project folder copied
✔ Images copied
✔ CSS copied
✔ JavaScript copied
✔ PHP files copied

Database

✔ Database selected
✔ Export completed
✔ SQL file saved

Backup Structure Example

XAMPP Backups
├── Website Files
│   └── security_dashboard
│       ├── index.php
│       ├── dashboard.php
│       ├── css
│       ├── js
│       └── images
│
└── Databases
    └── project_db.sql

You now have a complete backup of your XAMPP project.

Next tutorial: Restoring a XAMPP Project from Backup.

Restoring a XAMPP Project from BackupNew Page

If a project is accidentally deleted, corrupted, moved to another computer, or you need to continue working from a backup, both the website files and database must be restored.

This tutorial demonstrates how to restore a complete XAMPP project from a backup.


Backup Requirements

Before restoring, you should have:

XAMPP Backups
├── Website Files
│   └── security_dashboard
│
└── Databases
    └── project_db.sql

The project folder contains your website files and the SQL file contains your database backup.


Restore the Website Files

Open your backup folder.

Example:

XAMPP Backups
└── Website Files
    └── security_dashboard

Copy the entire project folder.


Copy the Files into htdocs

Open:

C:\xampp\htdocs\

Paste the project folder into the htdocs directory.

Example:

C:\xampp\htdocs\security_dashboard

Your project should now appear inside the XAMPP web server folder.

Start XAMPP

Open the XAMPP Control Panel.

Start:

Apache
MySQL

Open phpMyAdmin

Open:

http://localhost/phpmyadmin/

You should now see the phpMyAdmin home page.


Create the Database

Click:

New

Create a database using the original database name.

Example:

project_db

Click:

Create

Import the Database Backup

Select the newly created database.

Click:

Import

Choose:

project_db.sql

Click:

Import

phpMyAdmin will restore all tables and records from the backup file.

Verify the Database

Select the restored database.

You should see the original tables.

Example:

project_db
├── users
└── security_events

Click on a table and verify that records are present.

Test the Website

Open your project in a browser.

Example:

http://localhost/security_dashboard/

Check that:

Common Problems

Database Connection Error

Check:

Database name
Username
Password

inside your PHP connection file.

Example:

$conn = new mysqli(
    "localhost",
    "root",
    "",
    "project_db"
);

The database name must match the restored database.


Table Not Found

Example error:

Table 'project_db.users' doesn't exist

Solution:


Page Not Found

Example:

404 Not Found

Solution:

C:\xampp\htdocs\

Restoration Checklist

Website Files

✔ Project folder copied to htdocs
✔ Images restored
✔ CSS restored
✔ JavaScript restored
✔ PHP files restored

Database

✔ Database created
✔ SQL file imported
✔ Tables restored
✔ Records restored

Testing

✔ Website loads
✔ Database connection works
✔ Login system works
✔ Data displays correctly

Complete Restoration Process

Backup Folder
        ↓
Copy Project Files
        ↓
Paste into htdocs
        ↓
Create Database
        ↓
Import SQL File
        ↓
Test Website

You have successfully restored a XAMPP project from a backup.

Next tutorial: Moving a XAMPP Project to Another Computer.

Moving a XAMPP Project to Another Computer

One of the advantages of using XAMPP is that projects can easily be moved between computers.

This is useful when:

A complete project transfer requires:

  1. Website files.
  2. Database files.

On the Original Computer

Before moving the project, create a backup.

You should have:

XAMPP Backups
├── Website Files
│   └── security_dashboard
│
└── Databases
    └── project_db.sql

If you have not already created a backup, refer to:

Backing Up a XAMPP Project

Copy the Backup Files

Copy the backup folder to:

Example:

USB Drive
└── XAMPP Backups

image-1781051544998.png

Install XAMPP on the New Computer

Download XAMPP:

https://www.apachefriends.org/

Install XAMPP using the default settings.

The installation folder will usually be:

C:\xampp\

Start XAMPP

Open the XAMPP Control Panel.

Start:

Apache
MySQL

Both services should show a green status.

image-1781051802720.png

Copy the Website Files

Open:

C:\xampp\htdocs\

Copy the project folder from your backup.

Example:

security_dashboard

Paste it into:

C:\xampp\htdocs\

Your folder structure should now look like:

C:\xampp\htdocs\
└── security_dashboard

Create the Database

Open phpMyAdmin:

http://localhost/phpmyadmin/

Click:

New

Create a database with the same name as the original project.

Example:

project_db

Click:

Create

Import the Database Backup

Select:

project_db

Click:

Import

Choose:

project_db.sql

Click:

Import

Wait for the import to complete.

image-1781051867640.png

Verify the Tables

After importing, you should see the project tables.

Example:

project_db
├── users
├── security_events
└── products

Your tables may differ depending on the project.

Check the Database Connection

Open the database connection file used by the project.

Example:

$conn = new mysqli(
    "localhost",
    "root",
    "",
    "project_db"
);

Verify:

The default XAMPP configuration uses:

Server: localhost
Username: root
Password: (blank)

Test the Website

Open:

http://localhost/security_dashboard/

Check:

Common Problems

Database Not Found

Example:

Unknown database 'project_db'

Solution:


Table Not Found

Example:

Table 'project_db.users' doesn't exist

Solution:


Access Denied

Example:

Access denied for user 'root'

Solution:


Page Not Found

Example:

404 Not Found

Solution:

C:\xampp\htdocs\

Transfer Checklist

Website Files

✔ Project folder copied
✔ Files restored to htdocs
✔ Images restored
✔ CSS restored
✔ JavaScript restored
✔ PHP files restored

Database

✔ Database created
✔ SQL file imported
✔ Tables restored
✔ Data restored

Testing

✔ Website loads
✔ Database connection works
✔ Forms work
✔ Login works
✔ Data displays correctly

Complete Process

Original Computer
        ↓
Create Backup
        ↓
Copy to USB / Cloud Storage
        ↓
Install XAMPP
        ↓
Copy Website Files
        ↓
Create Database
        ↓
Import SQL File
        ↓
Test Website

You have successfully moved a XAMPP project to another computer.