WHMCS

Back up the WHMCS database automatically

Configure WHMCS daily database backups to email, FTP/SFTP or cPanel backups, add off-site copies, and restore WHMCS from a database backup when needed.

IntermediateWHMCS2 min read

The WHMCS database contains every client, invoice, transaction and ticket. Losing it would be a disaster for a hosting business. WHMCS can send a backup of its database every day during the cron run. Combined with your host's backups, this gives you a reliable recovery path.

Before you start

  • WHMCS admin access and a working cron.
  • A destination for backups: an SFTP or FTP server off the WHMCS machine, or your cPanel account's backup system.

Configure automatic backups

  1. Go to Configuration → System Settings → Database Backups.
  2. Choose and activate a method:
    • Secure FTP / FTP – enter host, port, user, password and destination folder. SFTP (port 22) is strongly preferred.
    • cPanel Backup – triggers a full cPanel account backup to a remote destination using your cPanel credentials or API token. This includes WHMCS files too.
    • Email – sends the compressed database by email. Only suitable for small databases, and email is not a secure place for customer data.
  3. Click Test Connection where offered, then Save Changes.

Backups run during the daily automation. Check Utilities → Automation Status the next day for the result.

Add independent backups

Don't rely on one method. Good practice for a hosting business:

  • WHMCS's own SFTP backup to a separate server or storage box.
  • Your hosting provider's daily backups of the account (MdmHost uses JetBackup on cPanel hosting).
  • A weekly manual export you store offline, especially before upgrades.

Make a manual backup

In cPanel, open phpMyAdmin, select the WHMCS database, click Export, choose Quick and SQL, and save the file. Over SSH:

mysqldump --single-transaction -u whmcs_user -p whmcs_db | gzip > whmcs-$(date +%F).sql.gz

Also copy configuration.php: it contains the $cc_encryption_hash, without which encrypted data (passwords, stored card references) in the database cannot be decrypted.

Important: keep a secure copy of configuration.php with every backup. A database restored without the matching encryption hash loses access to all encrypted fields.

Restore WHMCS from a backup

  1. Put WHMCS in maintenance mode: Configuration → System Settings → General Settings → Maintenance Mode.
  2. Create a fresh backup of the current (broken) state, just in case.
  3. In phpMyAdmin, drop all tables of the WHMCS database or create a new empty database.
  4. Import the backup SQL file.
  5. Ensure configuration.php has the matching database credentials and the original $cc_encryption_hash.
  6. Log in to the admin area, check recent invoices and transactions, then disable maintenance mode.

Payments received between the backup and the restore must be re-entered from your gateway reports.

Troubleshooting

  • FTP backup fails: wrong credentials, passive mode issues or the remote folder does not exist. Check the Activity Log for the error.
  • Backup email never arrives: the attachment is too large for your mail server. Switch to SFTP.
  • Import fails due to size: import via SSH with mysql instead of phpMyAdmin.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.