BACKUP ALL MYSQL DATABASES – COMPRESS SINGLE SCRIPT – EMAIL LOG
Please read the script fully before you execute. Actually there is no harm there but you have to know what you doing..
Just download the script and run via SSH-CLI terminal
- backup each mysql db into a different file, rather than one big file
- as with –all-databases. This will make restores easier.
- To backup a single database simply add the db name as a parameter (or multiple dbs)
-
mkdir -p /vv_files/backups
-
useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
- Remember to make the script executable, and unreadable by others
-
chown -R mysql-backup:backup /var/backups/mysql
-
chmod u=rwx,g=rx,o= /var/backups/mysql/dump.sh
- crontab entry – backup every 6 hours
- sudo crontab -e [ set your desired timing. 6 hrs is safer for sysadmins]