Backups separate professionals from gamblers. mysqldump exports databases as re-runnable SQL files — simple, portable, and scriptable, making it the first backup tool everyone should master.
Key Points
- Backup one database: mysqldump -u root -p sales_db > sales_backup.sql
- All databases: mysqldump --all-databases > full_backup.sql
- Structure only: --no-data; data only: --no-create-info
- Restore: mysql -u root -p sales_db < sales_backup.sql
- Use --single-transaction for consistent InnoDB backups without locking
- Automate with cron and always test restores — an untested backup isn't one
.png)