Automatic MySQL database backup and email via cPanel cron

Can someone help set up an automatic backup of the mysql database and then send it to me daily?

Thank.

+3
source share
3 answers

AutoMySQLBackup gets great reviews. I have not used it, but it seems to be doing exactly what you are looking for. In addition, here is another link with various backup methods, including emailing.

+3
source

Simple No need anymore.

#!/bin/sh
# Must be installed mutt on your box
mydate=$(date +"%Y%m%d%H%M")
host=$(hostname)
databases='' #'database1  database2 databaseN'

mysqldump --opt --all-databases > /tmp/$host.$mydate.sql
# if not all mysql databases mysqldump --opt $databases > /tmp/$host.$mydate.sql
gzip --best /tmp/mysql02.$mydate.sql
echo "Backup MySQL" | mutt -a /tmp/$host.$mydate.sql.gz -s "Backup MySQL $mydate" -- mail@mail.to
0
source

Source: https://habr.com/ru/post/1737533/


All Articles