Technology

MySQL Backup Strategies: mysqldump, Percona XtraBackup or Snapshots?

When you are responsible for a MySQL database behind a real website or SaaS product, “having some backups somewhere” is not a strategy. You need a plan that matches how your application is hosted, how big the database is, and how quickly you must recover after a problem. On typical web hosting (from shared hosting to VPS and dedicated servers), three tools appear again and again: mysqldump, Percona XtraBackup and various kinds of snapshots (LVM, ZFS, hypervisor or storage snapshots).

Each of these solves a different problem. mysqldump is simple and almost always available. XtraBackup is designed for fast, hot backups on serious MySQL and MariaDB workloads. Snapshots can roll back an entire server in minutes, but they behave differently from database-aware backups. In this article, we will walk through how each works, their strengths and weaknesses on shared hosting, VPS and dedicated servers at dchost.com, and how to combine them into a practical MySQL backup strategy you can trust.

İçindekiler

Why MySQL Backup Strategy Matters on Web Hosting

Before choosing tools, it helps to think in terms of RPO and RTO:

  • RPO (Recovery Point Objective): How much data (time) you can afford to lose. For example, 15 minutes vs 24 hours.
  • RTO (Recovery Time Objective): How long it can take to get the database back online after a failure.

If your RPO is 24 hours and your RTO is “a few hours”, a simple nightly mysqldump might be enough. If your RPO is 5 minutes and you need to be back online in under 15 minutes, you will very likely need physical backups (XtraBackup) and some form of snapshots or replicas.

We discussed RPO, RTO and backup planning more generally in our guide on how to design a backup strategy for blogs, e‑commerce and SaaS sites. In this article we zoom specifically into MySQL on real hosting environments and compare mysqldump, Percona XtraBackup and snapshot-based approaches so you can decide what actually fits your project.

Three Main Approaches: Logical, Physical and Snapshot Backups

Most MySQL backup solutions fall into one of these categories:

Logical backups (mysqldump, mysqlpump, etc.)

A logical backup exports data and schema as SQL statements (CREATE TABLE, INSERT, ALTER TABLE…). It does not copy the raw data files on disk. Instead, it reads rows from MySQL and writes them into a text file.

  • Portable across MySQL and MariaDB versions (with some caveats).
  • Easy to inspect and restore to a different schema or server.
  • Slower and more CPU-intensive on large databases.

Physical backups (Percona XtraBackup, mariabackup)

Physical backups copy the actual InnoDB data files (.ibd, ib_logfile, ibdata, etc.) on disk. They aim to be fast and minimally disruptive, often by reading data files directly while MySQL continues to accept writes.

  • Much faster on large databases (tens or hundreds of GB).
  • Support incremental backups and point-in-time recovery.
  • Tightly coupled to engine/storage format and MySQL/MariaDB versions.

Filesystem / volume snapshots (LVM, ZFS, hypervisor snapshots)

Snapshots freeze the whole disk or volume at a point in time. Think of them as a “photo” of the filesystem or virtual disk, often taken in milliseconds.

  • Very fast to create and to roll back.
  • Capture not only MySQL but also configs, logs, app code, etc.
  • Without proper coordination, they are only crash-consistent, not application-consistent.

We went deeper into application-consistent snapshots with LVM and fsfreeze in our article on taking application-consistent hot backups with LVM snapshots for MySQL and PostgreSQL. For now, the key idea is that snapshots are great when combined with database-specific steps, not as a blind “magic button”.

mysqldump: Simple Logical Backups That Run Almost Everywhere

mysqldump comes with MySQL and MariaDB, and on shared hosting it is usually the only backup tool you can fully control. It connects to the database over the normal MySQL protocol and dumps tables as SQL.

How mysqldump works

At its simplest:

mysqldump -u user -p database_name > database_name.sql

This creates a plain text file you can restore later with:

mysql -u user -p database_name < database_name.sql

On InnoDB, you typically want a consistent snapshot of all tables. For that, use the --single-transaction option (and avoid long DDLs during the dump):

mysqldump --single-transaction --routines --triggers 
  -u user -p database_name | gzip > database_name-$(date +%F).sql.gz

Advantages of mysqldump on web hosting

  • Universal availability: Works on shared hosting, VPS and dedicated servers.
  • Human-readable output: Easy to inspect, grep, and version-control small schema changes.
  • Fine-grained: You can dump a single database, schema or even a subset of tables.
  • Portable: Convenient for migrations between servers or versions, as long as you test.

Limitations of mysqldump

  • Performance on large databases: mysqldump is single-threaded. A 50–100 GB database will take a long time to dump and restore.
  • Server load: Reading all rows can temporarily pressure CPU, I/O and buffer pool, affecting live traffic.
  • RTO can be high: Restoring a large SQL dump can take hours.
  • Binary logs still matter: If your RPO is less than dump frequency, you need point-in-time recovery via binary logs.

mysqldump use cases

  • Small to medium sites on shared hosting where database size is a few hundred MB or low single-digit GB.
  • Development and staging databases, where simplicity is more important than raw speed.
  • Schema-only backups before risky migrations.
  • Supplement to physical backups: keeping periodic logical dumps for extra safety.

If you want a deeper dive into tuning mysqldump, compression and binary logs, we covered the technical details in our article on mysqldump vs XtraBackup and point‑in‑time recovery for MySQL/MariaDB. Here we will stay focused on how mysqldump fits into wider hosting strategies.

Percona XtraBackup: Hot Physical Backups for Serious Workloads

Percona XtraBackup (and its MariaDB variant, mariabackup) is a physical backup tool that can copy InnoDB data files while the database continues to accept reads and writes. This is ideal for busy production systems where downtime is not acceptable.

How XtraBackup works (high level)

XtraBackup:

  • Reads InnoDB tablespace files and transaction logs directly from disk.
  • Tracks changes during the backup using redo logs.
  • After copying, applies the logs to make a consistent snapshot of the data at a specific point in time.

The usual flow is:

  1. Run a full backup to a backup directory.
  2. Optionally create incremental backups that store only changed pages.
  3. Prepare the backup (apply logs).
  4. Restore by copying the prepared files back into MySQL’s datadir.

Advantages of XtraBackup on VPS and dedicated servers

  • Hot backups: No global read lock for InnoDB tables; application downtime is minimal or zero.
  • Speed: Much faster than mysqldump on large InnoDB datasets.
  • Incrementals: Efficient daily/hourly backups with less disk and bandwidth usage.
  • Good RTO: Restoring involves copying files instead of replaying millions of INSERT statements.

Limitations and requirements of XtraBackup

  • Root / filesystem access needed: You typically need shell access and sufficient privileges. This is not available on standard shared hosting, but normal on VPS, dedicated and colocation servers at dchost.com.
  • InnoDB focus: Best for InnoDB. MyISAM and other engines often require additional care or brief locks.
  • Version compatibility: The backup/restore server versions must be compatible. You cannot freely jump between major versions without planning.
  • More moving parts: You need scripts, monitoring and retention policies to manage backup directories properly.

XtraBackup use cases

  • Busy e‑commerce stores running WooCommerce, Magento, or custom carts on a VPS or dedicated server.
  • SaaS applications with strict RPO/RTO where restoring quickly matters as much as having data.
  • Large databases (tens or hundreds of GB) where mysqldump becomes too slow.
  • Environments that already use replication: XtraBackup can seed replicas quickly without long logical imports.

For many dchost.com VPS and dedicated server customers running MySQL/MariaDB at scale, we recommend XtraBackup as the main database-level backup mechanism, often paired with snapshots and offsite storage.

Filesystem and Volume Snapshots: LVM, ZFS and Hypervisor Snapshots

Snapshots work at the storage layer, not inside MySQL. They freeze a block device, volume, or entire virtual disk at a moment in time. Common examples include:

  • LVM snapshots on Linux.
  • ZFS snapshots and clones.
  • Hypervisor / storage snapshots offered on virtual servers and storage backends.

Crash-consistent vs application-consistent

By default, a snapshot is crash-consistent: it is equivalent to pulling the power cable at that instant. InnoDB is pretty good at recovering from this by replaying its redo logs on startup. However, this still carries risk and might take time if the workload is very busy.

An application-consistent snapshot coordinates with MySQL so that all outstanding writes are flushed before the snapshot is taken. This can be achieved by steps such as:

  • Running FLUSH TABLES WITH READ LOCK and/or FLUSH LOGS.
  • Using fsfreeze on the filesystem where MySQL stores data.
  • Pausing background jobs that hit the database heavily during the few seconds of snapshot.

In our detailed walkthrough on using LVM snapshots and fsfreeze for application-consistent MySQL backups, we show how to combine these commands in a short runbook so you get snapshot speed without compromising data consistency.

Advantages of snapshots

  • Speed: Creating a snapshot is usually a matter of seconds, no matter how big the disk is.
  • Full-server rollbacks: You can restore not just MySQL but also configs, app code, cron jobs and logs to a known-good state.
  • Great for quick disaster recovery after a bad deployment or system misconfiguration.

Limitations of snapshots

  • Not a substitute for offsite backups: Snapshots live on the same storage platform. If the underlying storage fails or is corrupted, snapshots go with it.
  • Provider-specific: Hypervisor or storage snapshots depend on the hosting platform. You cannot always migrate them easily.
  • Retention cost: Keeping many snapshots can consume storage quickly if blocks change often.
  • Requires careful scripting to ensure application consistency and predictable restore steps.

Snapshot use cases

  • VPS and dedicated servers where you control the OS and can use LVM/ZFS snapshots.
  • As a fast “first line of defense” before big migrations or software updates.
  • As part of a 3‑2‑1 strategy, combined with database-level backups and offsite copies.

If you are new to storage planning and offsite copies, our guide to the 3‑2‑1 backup strategy and automating backups on cPanel, Plesk and VPS is a good companion to this article.

How to Choose: mysqldump vs XtraBackup vs Snapshots

There is no single “best” tool. The right choice depends on your hosting type, database size and business requirements. Often, the answer is a combination of methods.

Quick comparison table

Criterion mysqldump Percona XtraBackup Snapshots (LVM/ZFS/hypervisor)
Works on shared hosting? Yes (almost always) No (needs shell & root) Sometimes (provider-controlled)
Best for DB size Small/medium (< 5–10 GB) Medium/large (> 5–10 GB) Any (size-agnostic)
Backup speed Slow/medium Fast Very fast snapshot; copy-out may vary
Impact on live traffic Noticeable on busy sites Low (InnoDB hot backup) Low if coordinated; otherwise crash-consistent only
Restore speed (RTO) Slow for big DBs Fast (file copy) Very fast rollbacks; full-server scope
Granularity Per DB / per table Full instance or selected databases Whole volume or VM
Offsite portability Excellent (text / compressed) Good (archives of backup dir) Depends (often needs extra tooling)

Typical patterns we see at dchost.com

  • Small site on shared hosting: Daily or twice-daily mysqldump, plus whatever panel-level backups your hosting plan includes.
  • Growing e‑commerce site on a VPS: Nightly XtraBackup full, hourly incrementals, plus daily filesystem snapshots before deployments.
  • SaaS app on multiple VPS or dedicated servers: XtraBackup from the primary or a replica, LVM/hypervisor snapshots for fast rollback, and offsite object storage for long-term retention.

For SaaS specifically, we have a separate guide on backup and data retention best practices for SaaS apps on VPS and cloud hosting, which you can combine with the MySQL-focused patterns in this article.

Designing a Practical MySQL Backup Plan on Shared Hosting

On classic shared hosting you usually do not control the underlying OS or storage. That means no XtraBackup and no LVM/ZFS-level access. But you still have options.

What you typically have

  • mysqldump via SSH or inside the control panel.
  • Panel-level backups (e.g., full account backups, home directory + MySQL).
  • cron jobs to schedule dumps and upload them to remote storage.

A reasonable shared hosting MySQL strategy

  1. Automate nightly logical dumps
    Use mysqldump with --single-transaction and gzip. Rotate 7–14 days of daily dumps.
  2. Combine with hosting provider backups
    Most shared accounts include provider-side backups. Treat them as an extra layer, not your only layer.
  3. Send copies offsite
    Use a simple script to push compressed dumps to remote storage or another hosting account. This aligns with the 3‑2‑1 rule (3 copies, 2 media, 1 offsite).
  4. Test restores in a separate database
    Periodically restore a backup to a test database and load a copy of your application against it.

If your shared hosting includes cPanel, our full cPanel backup and restore guide for files, databases and emails and our article on WordPress backup strategies for shared hosting and VPS show how to combine panel tools with manual mysqldump for extra resilience.

When to move beyond shared hosting for backups

If your MySQL database grows beyond a few GB, or your business cannot tolerate more than a few minutes of downtime and data loss, it might be time to move to a VPS or dedicated server plan at dchost.com. That will give you access to XtraBackup, LVM/ZFS and custom backup scripts that are not possible in a shared environment.

Designing a Practical MySQL Backup Plan on VPS or Dedicated Servers

On a VPS, dedicated server or colocated server at dchost.com, you control the OS and can design a layered backup strategy that combines database-aware tools with snapshots and offsite copies.

A battle-tested pattern we like

  1. Primary layer: XtraBackup (or mariabackup)

    • Nightly full backup to a dedicated backup volume.
    • Hourly incremental backups if your RPO is tighter.
    • Retention: e.g., 7 daily, 4 weekly, 3 monthly backups.
  2. Secondary layer: application-consistent snapshots

    • LVM/ZFS snapshots on the MySQL data volume before schema migrations or major releases.
    • Hypervisor-level snapshots of the entire VPS before OS-level changes.
  3. Offsite layer: remote object storage or backup server

    • Sync XtraBackup archives and/or snapshot exports to an offsite location.
    • Encrypt at rest; monitor replication jobs and integrity.

Incorporating RPO and RTO

Let us map requirements to techniques:

  • RPO ≤ 1 hour: Hourly XtraBackup incrementals or binary log streaming to a standby server.
  • RTO ≤ 15–30 minutes: Keep recent XtraBackup sets on local fast storage, plus LVM/hypervisor snapshots to roll back whole servers quickly if necessary.
  • RPO ≤ 5–10 minutes: Consider combining backups with replication so you can promote a replica and backfill via binlogs if the primary is lost.

Our article on writing a realistic disaster recovery plan goes into more detail on turning these numbers into concrete runbooks and recovery tests.

Automation and monitoring

A backup that is not monitored will fail the day you need it. On VPS and dedicated servers we recommend:

  • Systemd units and timers or cron jobs to run backup scripts.
  • Logging backup duration, size and success status.
  • Alerts when a backup is missing, too small, or older than expected.
  • Regular restore drills to a staging environment.

Common MySQL Backup Mistakes (and How to Avoid Them)

After years of helping customers at dchost.com, we keep seeing the same MySQL backup issues on web hosting. Avoid these and you are already ahead of most setups.

1. Relying only on hosting provider snapshots

Provider snapshots are useful, but they are not a complete strategy:

  • They live on the same platform as your server.
  • They may not be application-consistent.
  • Retention policies can be opaque or limited.

Fix: Treat snapshots as one layer. Add mysqldump or XtraBackup plus offsite storage so you can restore even if the primary platform has a major incident.

2. Storing backups on the same disk as the database

If your backups are on /var/lib/mysql/backups and the underlying disk dies, your backups die too.

Fix: Store backups on a separate volume, server or object storage. The 3‑2‑1 rule (three copies, two media, one offsite) from our 3‑2‑1 backup strategy guide is a good mental model here.

3. Never testing restores

Running backups but never testing restores is like buying an umbrella and never opening it until a storm. Sometimes the file is corrupted, encrypted with a forgotten key, or missing important tables.

Fix: Schedule periodic restore tests:

  • On shared hosting, restore a mysqldump into a new database and point a test copy of your app at it.
  • On VPS/dedicated, spin up a staging instance and restore the latest XtraBackup set or snapshot clone.

4. Ignoring binary logs and point-in-time recovery

If you only take nightly full backups, your RPO is at best 24 hours. Accidental deletions or bad migrations at 16:00 mean you lose everything since midnight.

Fix: Enable binary logs and keep them for enough time to meet your RPO. Combine full backups (mysqldump or XtraBackup) with binlog-based point-in-time recovery to replay changes up to just before the incident.

5. No encryption or access control around backups

Backups often contain the most complete version of your customer data. Leaving them unencrypted on a public bucket or a poorly secured server is a major risk.

Fix: Encrypt backups at rest, secure offsite locations with strong credentials, and restrict access to only those who really need it. This is especially important if you operate under KVKK or GDPR; our article on KVKK and GDPR‑compliant hosting covers the regulatory side of data protection in more depth.

Bringing It All Together with dchost.com

mysqldump, Percona XtraBackup and snapshots each solve different parts of the MySQL backup puzzle. On shared hosting, mysqldump plus panel-level backups and an offsite copy can give you a solid, simple safety net. On VPS, dedicated servers and colocation, you can layer XtraBackup, application-consistent snapshots and remote storage to reach strict RPO/RTO targets and sleep better at night.

At dchost.com we see daily how a well-thought-out backup design turns “we hope it is backed up” into “we know exactly how to recover”. If you are unsure which combination fits your database size, traffic level and compliance requirements, reach out to our team. We can help you choose the right hosting tier (shared, VPS, dedicated or colocation), design a practical MySQL backup and restore runbook, and integrate it with your existing monitoring and deployment flows.

Start by reviewing your current situation: What is your real RPO/RTO? Where are your backups physically stored? When was the last successful restore test? From there, we can help you decide where mysqldump is enough, where XtraBackup should take over, and how snapshots and offsite copies complete a robust, production-ready MySQL backup strategy on dchost.com infrastructure.

Frequently Asked Questions

For a small WordPress or similar PHP site on classic shared hosting, mysqldump is usually the most practical option. It is almost always available, can be run via SSH or scheduled with cron, and works well for databases up to a few GB. Combine daily or twice-daily mysqldump with your hosting provider’s built‑in account backups and store compressed SQL dumps offsite for extra safety. Snapshots and XtraBackup generally require VPS or dedicated servers with OS-level access, so they are not typically available on standard shared hosting plans.

No, snapshots alone should not be your only MySQL backup strategy. Provider or hypervisor snapshots are great for fast rollbacks and full‑server recovery, but they live on the same platform as your server and may only be crash‑consistent, not application‑consistent. A serious incident on the underlying storage could wipe out both the server and its snapshots. Always combine snapshots with database‑aware backups such as mysqldump or Percona XtraBackup, and keep at least one copy offsite as part of a 3‑2‑1 strategy.

Consider switching from mysqldump to XtraBackup when your database grows beyond a few GB, backups or restores start taking too long, or the dump process noticeably impacts production traffic. XtraBackup is especially valuable for busy e‑commerce and SaaS workloads on VPS or dedicated servers where you need hot backups, shorter RTO, and incremental backups. You can still keep periodic mysqldump exports for portability, but XtraBackup should become the main engine once you need faster, low‑impact backups for larger InnoDB datasets.

For an active e‑commerce site, a common pattern is nightly full backups plus more frequent incrementals or binlog‑based recovery. Many teams aim for an RPO of 5–15 minutes, which means either rotating binary logs with point‑in‑time recovery or running hourly incremental backups with Percona XtraBackup. Snapshots can be added before big deployments for fast rollback. The exact schedule depends on how much order and customer data you are willing to lose, but anything beyond 1 hour of potential data loss is usually too risky for serious online stores.

The only reliable way is to perform regular restore tests. On shared hosting, restore a recent mysqldump into a separate test database, update your application configuration to point at it, and verify that the site works as expected. On VPS or dedicated servers, spin up a staging instance and restore a recent XtraBackup set or snapshot clone, then run application‑level checks. Automate these tests where possible and document the steps in a simple runbook. If a backup has never been restored in practice, you should assume it might fail until proven otherwise.