5.7 KiB
Restore Guide
Step-by-step procedures for restoring from each backup type supported by backup-mcp.
Restore from Database Backup (MySQL)
Database backups are stored as gzip-compressed SQL dumps ({name}-db-{timestamp}.sql.gz).
Step 1: Identify the backup to restore
backup_list(target: "mysite-db")
Select the backup file by date.
Step 2: Upload the backup to the server
scp ~/backups/mysite/mysite-db-2026-05-09T12-00-00.sql.gz user@server:/tmp/
Step 3: Stop the application (recommended)
ssh user@server "sudo systemctl stop apache2"
Step 4: Restore the database
ssh user@server "gunzip < /tmp/mysite-db-2026-05-09T12-00-00.sql.gz | mysql -u dbuser -p'password' database_name"
For a clean restore (drop and recreate):
ssh user@server << 'EOF'
mysql -u dbuser -p'password' -e "DROP DATABASE database_name; CREATE DATABASE database_name;"
gunzip < /tmp/mysite-db-2026-05-09T12-00-00.sql.gz | mysql -u dbuser -p'password' database_name
EOF
Step 5: Restart the application
ssh user@server "sudo systemctl start apache2"
Step 6: Verify
ssh user@server "mysql -u dbuser -p'password' database_name -e 'SHOW TABLES;'"
Restore from Database Backup (PostgreSQL)
PostgreSQL backups are also gzip-compressed ({name}-db-{timestamp}.sql.gz).
Steps
# Upload
scp ~/backups/mydb/mydb-db-2026-05-09T12-00-00.sql.gz user@server:/tmp/
# Restore
ssh user@server "gunzip < /tmp/mydb-db-2026-05-09T12-00-00.sql.gz | PGPASSWORD='password' psql -U dbuser database_name"
For a clean restore:
ssh user@server << 'EOF'
PGPASSWORD='password' dropdb -U dbuser database_name
PGPASSWORD='password' createdb -U dbuser database_name
gunzip < /tmp/mydb-db-2026-05-09T12-00-00.sql.gz | PGPASSWORD='password' psql -U dbuser database_name
EOF
Restore from File Backup
File backups are tar.gz archives of remote directories ({name}-files-{timestamp}.tar.gz).
Step 1: Identify the backup
backup_list(target: "mysite-files")
Step 2: Upload the archive to the server
scp ~/backups/mysite/mysite-files-2026-05-09T12-00-00.tar.gz user@server:/tmp/
Step 3: Extract to the original location
ssh user@server "cd / && tar xzf /tmp/mysite-files-2026-05-09T12-00-00.tar.gz"
The tar archive preserves the full path structure from remotePaths. Extracting from / restores files to their original locations.
Step 4: Fix permissions
ssh user@server << 'EOF'
chown -R www-data:www-data /var/www/html/images
chown -R www-data:www-data /var/www/html/media
find /var/www/html/images -type f -exec chmod 644 {} +
find /var/www/html/images -type d -exec chmod 755 {} +
EOF
Step 5: Verify
ssh user@server "ls -la /var/www/html/images/"
Restore from Akeeba Backup
Akeeba backups are JPA archives that contain both the database and all site files.
Step 1: List available Akeeba backups
akeeba_list(target: "mysite-akeeba")
Step 2: Download the backup locally
akeeba_download(target: "mysite-akeeba", backup_id: "42")
The file is saved to localBackupDir as {name}-akeeba-{id}-{timestamp}.jpa.
Step 3: Upload to the server
scp ~/backups/mysite-akeeba/mysite-akeeba-42-2026-05-09T12-00-00.jpa user@server:/tmp/
Step 4: Extract using Akeeba Kickstart
- Download Akeeba Kickstart and upload
kickstart.phpto the web root:
scp kickstart.php user@server:/var/www/html/
-
Open
https://example.com/kickstart.phpin a browser. -
Select the JPA file from
/tmp/and follow the wizard:- Archive file:
/tmp/mysite-akeeba-42-2026-05-09T12-00-00.jpa - Extract to:
/var/www/html - Click Start to extract
- Archive file:
-
After extraction, the Akeeba Installer (ANGIE) will launch automatically:
- Verify database connection settings
- Update site URL if restoring to a different domain
- Complete the restoration
Step 5: Clean up
ssh user@server "rm /var/www/html/kickstart.php /tmp/*.jpa"
Step 6: Verify
Visit the site in a browser and check:
- Frontend loads correctly
- Administrator login works
- Media files are accessible
Restore Checklist
| Step | Database | Files | Akeeba |
|---|---|---|---|
| Identify backup | backup_list |
backup_list |
akeeba_list |
| Download/locate | Already local | Already local | akeeba_download |
| Stop application | Recommended | Optional | Required |
| Upload to server | SCP | SCP | SCP |
| Restore | mysql / psql |
tar xzf |
Kickstart + ANGIE |
| Fix permissions | N/A | chown + chmod |
Handled by ANGIE |
| Restart application | Yes | Optional | Yes |
| Verify | Query tables | List files | Browse site |
Important Notes
- Always create a fresh backup before restoring, in case the restore needs to be reverted.
- For Joomla sites, clear the cache after any restore: System > Clear Cache in the administrator.
- Database restores overwrite all data in the target database. Ensure you are restoring to the correct database.
- File restores overwrite existing files at the same paths. Files not in the backup are left untouched.
- Akeeba restores are the most complete option for Joomla sites, as they include both database and files.
Built on MokoStandards
Repo: backup-mcp · MokoStandards
| Revision | Date | Author | Description |
|---|---|---|---|
| 1.0 | 2026-05-09 | Moko Consulting | Initial version |