The backup MariaDB command uses mysqldump or mariabackup to export all or selected databases into a portable file for disaster recovery or migration.
Backups protect data from hardware failure, human error, or malicious activity. Regular exports let you restore service quickly and migrate data to PostgreSQL, testing, or staging servers.
mysqldump creates logical SQL dumps ideal for smaller datasets and cross-engine restores. mariabackup performs physical, hot backups suitable for large, InnoDB-heavy databases.
Use mysqldump when the ecommerce database is under 50 GB, downtime must be minimal, and portability matters.It produces plain SQL you can inspect, edit, and load into other systems.
Pass --single-transaction
to avoid locking InnoDB tables. Combine with --quick
so rows stream directly to the dump file, reducing memory usage.
Yes. List tables after the database name: mysqldump ecommerce Customers Orders > partial.sql
.This keeps file sizes smaller and speeds up restores.
Schedule a cron job: 0 2 * * * /usr/bin/mysqldump -u backup -p$PWD ecommerce > /backups/`date +\%F`.sql
. Store files on off-site or cloud storage for redundancy.
Enable binary logging and archive the binlog
files.After restoring the last full dump, replay binlogs with mysqlbinlog
up to the exact second before failure.
Use a translation tool such as pgloader
: pgloader mysql://user:pass@host/ecommerce postgresql:///ecommerce
. It reads the SQL dump, converts data types, and loads directly into PostgreSQL.
Create a throwaway MariaDB container and load the dump: docker run --rm -e MARIADB_ROOT_PASSWORD=mypass -v $(pwd)/ecommerce_backup.sql:/docker-entrypoint-initdb.d/1.sql mariadb:latest
. Verify counts with SELECT COUNT(*) FROM Orders;
.
.
mariabackup is faster for large datasets and supports incremental backups. Use it when downtime must be near zero and storage layout can be replicated.
Dumps grow with data volume. Use --compress and pipe through gzip
to reduce size. Split huge dumps with split -b 2G
to ease transfers.
Yes. Pipe the output through gpg
: mysqldump ... | gpg -c -o ecommerce.sql.gpg
. Store keys securely and document the decryption process.