MySQL: Automate MySQL Dump
Need to backup all the databases daily
mysqldump --all-databases --single-transaction --quick --lock-tables=false > full-backup-$(date +%F).sql -u root -p
Then edit in home directory a login connection file .mylogin.cnf
vi /home/admin/.mylogin.cnf
[client]
user = root
password = "the db password"
Limit the permission on the file to 600
chmod 600 /home/admin/.mylogin.cnf
Now in /etc/cron.daily/mysqldump file include the daily schedule cron job
0 1 * * * /usr/bin/mysqldump --defaults-extra-file=/home/admin/.mylogin.cnf -u root --single-transaction --quick --lock-tables=false --all-databases > full-backup-$(date +\%F).sql