Skip to content
Bash script for backup MySQL SSH
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Backupper MySQL

This script is designed to create MySQL database backups.

The script automatically finds all databases, so you don't have to add new, unless you have some exceptions. You can also transfer the key to back up only certain databases.

The script contains the following settings:

Connection settings:


Archives retention period:


Directory for save archive:


A list of excluded databases (database is a part of SHOW DATABASES output):


An array of excluded tables (requires BASH v. 4 >=). The structure of the excluded tables will be saved in the backup file:

EXCLUDED_TABLES[example_db]="example_table example_table2"

Parameter for change the store time (days) "-t":

$ ./ -t 10

If you do not want the script to back up the new bases, then upon running, specify that you want to back up, using the "-b" parameter:

$ ./ -b "example_db example_db2"

To exclude tables from data base "-e":

$ ./ -e "example_db.example_table example_db.example_table2"

If you want add custom parameters, use the parameter "-p":

$ ./ -p "--hex-blob"

Example for cron. Backup all databases:

0 * * * * backupper_mysql/ >/dev/null 2>&1

You can’t perform that action at this time.