# Borg MySQL Backup

Borg MySQL Backup is a Docker backup container for homelab and server environments that backs up MySQL or PostgreSQL database dumps to local or remote BorgBackup repositories, with optional file and directory backup. It is open source and self-hosted, installable on Docker Hub and Unraid.

Canonical page: https://ourlocalhost.com/app/1443/borg-mysql-backup

## Description

Borg MySQL Backup is a Docker backup container for homelab and server environments that backs up MySQL or PostgreSQL database dumps to local or remote BorgBackup repositories, with optional file and directory backup for versioned database protection.

## Platform availability

Available on 1 of 9 platforms: Unraid.

## Health score

55/100 (Fair), based on 3 of 4 factors.
- Maintained: 83 (last commit 148 days ago)
- Popular: 25 (17 GitHub stars)
- Easy to install: 35 (1 install platform, install notes, Docker image)

## Links

- Docker Hub: https://hub.docker.com/r/layr/borg-mysql-backup
- GitHub: https://github.com/laur89/docker-borg-mysql-backup
- Unraid: https://ca.unraid.net/apps/borg-mysql-backup-1gcidwl16c6y81?q=borg-mysql-backup

## Common questions

### How do I run borg-mysql-backup on a schedule?

Put a crontab file named crontab in the /config mount and run the backup script by cron. For remote Borg usage, also mount a passwordless SSH key named id_rsa in /config.

### Do I need to create the Borg repository before using this container?

Yes. Both local and remote repositories must be initialized manually beforehand. You can start the image interactively and use the shell to initialize a repository if needed.

### Can it stop other Docker containers while taking the backup?

Yes, specify the container names to the backup script. This requires mounting the Docker socket, which effectively gives the container root permissions on the host.

### Can I back up files without creating database dumps?

Yes. Other files and directories can be included in the backup, and database dumps can be excluded altogether.

### What error notifications does borg-mysql-backup support?

It can send error notifications via SMTP, Pushover, or a Healthchecks /fail endpoint. You can put a custom msmtprc file in /config instead of defining SMTP environment variables.

### Where should I store Borg's config and cache?

Bind host directories to /root/.cache/borg and /root/.config/borg, which is strongly recommended. You can also relocate them with BORG_CACHE_DIR and BORG_CONFIG_DIR.

---
Source: Our Local Host (https://ourlocalhost.com/app/1443/borg-mysql-backup), the self-hosted and open-source app directory.
