Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/realtriassic/mysql-backup
A bash script to automatically dump, compress and store your MySQL/MariaDB database backups.
https://github.com/realtriassic/mysql-backup
backup backup-script bash mariadb mysql mysqldump-backup
Last synced: about 1 month ago
JSON representation
A bash script to automatically dump, compress and store your MySQL/MariaDB database backups.
- Host: GitHub
- URL: https://github.com/realtriassic/mysql-backup
- Owner: RealTriassic
- License: unlicense
- Created: 2023-09-07T15:03:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-07T15:37:46.000Z (over 1 year ago)
- Last Synced: 2024-11-12T18:15:03.809Z (3 months ago)
- Topics: backup, backup-script, bash, mariadb, mysql, mysqldump-backup
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MySQL-Backup
A bash script to automatically dump, compress and store your MySQL/MariaDB database backups.# Configuration
- `BACKUP_DIR` - The directory to be used for storing the database backups.
- `MYSQL_USER` - MySQL username, typically you'd use the root user.
- `MYSQL_PASSWORD` Password for your MySQL user, if user has no password, keep as empty string.
- `BACKUPS_TO_KEEP` - Amount of backups to store before deleting the oldest one.Once configured, I recommend running the script at least once manually and see if backups are created successfully.
## Making it run automatically
You can use a simple cronjob to make it execute the script automatically.⚠️ **This is an example**, you may have to edit the cronjob if you have renamed/relocated the script.
1. Run `crontab -e` to open the cronjob editor.
2. Press `i` to enable insert mode in the editor.
3. Paste this into a new line: `0 0 * * * bash /root/backup.sh >> /dev/null 2>&1`
4. Press ESC (Escape) on your keyboard.
5. Type `:wq` to save and exit.> This is going to create a new backup of all databases every 24 hours at midnight, but you can adjust the cronjob as you wish to have it run whenever you want.
# License
This project is licensed under the Unlicense License, you may view the LICENSE [here](https://github.com/RealTriassic/MySQL-Backup/blob/main/LICENSE).