What this is
mysqldump creates a logical backup (SQL file) of MySQL/MariaDB databases.
What it is for
- Backup before updates or migrations
- Restore data after mistakes
Prerequisites
- MySQL/MariaDB installed
- Credentials for a user with backup privileges
- Enough disk space for the dump
Step-by-step
Backup one database
mysqldump -u appuser -p appdb > appdb_backup.sql
Expected output: Usually silent; file is created.
Backup all databases (admin use)
mysqldump -u root -p --all-databases > all_databases_backup.sql
Compress the backup (recommended)
gzip -k appdb_backup.sql
Verify the file
ls -lah *.sql *.gz
head -n 20 appdb_backup.sql
Warnings & notes
- Large databases can create huge dumps; consider compression and off-server storage.
- Keep backup files protected; they may contain sensitive data.
Conclusion
mysqldump is the simplest reliable backup format. Next step: automate it and store backups safely.