
mysqldump is a command-line utility included with every MySQL and MariaDB installation. It exports one or more databases as a plain SQL file — a series of CREATE TABLE and INSERT INTO statements that reconstruct the database from scratch when run against a fresh MySQL instance.
You need MySQL credentials with at least SELECT, LOCK TABLES, and SHOW VIEW privileges on the databases you want to back up. For a dedicated backup user, run: GRANT SELECT, LOCK TABLES, SHOW VIEW ON *.* TO 'backup_user'@'localhost' IDENTIFIED BY 'password';
The --single-transaction flag is critical for WordPress and other InnoDB databases — it takes a consistent snapshot without locking any tables, meaning the site stays responsive during backup. The --quick flag writes rows one at a time instead of buffering them in memory, which prevents crashes on large databases.
The --events, --routines, and --triggers flags include stored procedures, functions, and event scheduler definitions that are otherwise omitted from the default dump.
Avoid putting passwords directly in cron command lines or scripts. Use a MySQL option file instead:
For a cron line that runs at 3am daily and keeps 14 days of backups: 0 3 * * * mysqldump my_db | gzip > /backups/$(date +\%Y\%m\%d).sql.gz && find /backups -mtime +14 -delete
CloudStick's Database Backups section handles mysqldump, compression, storage, and retention automatically — you enable backup per-database, set the schedule and retention period, and CloudStick runs the dump on schedule and stores it in managed offsite storage.
See the CloudStick knowledge base: How to Download a Database Backup to Localhost for the step-by-step walkthrough of downloading a specific backup file from the dashboard for local restore testing.


We use cookies to improve your experience
CloudStick uses cookies to personalise content, analyse traffic and keep you signed in. Cookie Policy · Terms of Service