This runbook describes the process to back up a MySQL database.
Prerequisites
- Access to the database server
- Database credentials
Steps
- Login to the Database Server
ssh user@db-server
- Dump the Database
mysqldump -u root -p database_name > backup.sql
- Compress the Backup
tar czf backup.tar.gz backup.sql
- Transfer the Backup to a Safe Location
scp backup.tar.gz user@backup-server:/path/to/backup/
- Remove Old Backups
find /path/to/backup/ -type f -mtime +30 -exec rm {} \;
Verification
- Check the backup file size and integrity.
- Verify the backup exists on the backup server.