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

RELATED POST

Veritas Volume Manager: Growing a disk group and expand the filesystem

Validated by Mr Man! Lets start off on node2 [root@node02 ~]# vxdisk list DEVICE TYPE DISK GROUP STATUS sda auto:none…

Virtual Machine Manager: Error starting domain

Starting up the KVM error occurred Error starting domain: Requested operation is not valid: network 'default' is not active Locate…

Git Commands

How to initialize a Git repo: Everything starts from here. The first step is to initialize a new Git repo…

Lab Hack: Raspberry Pi running VMWare ESXi

As strange as the title sounds, yes I am running VMWare ESXi on a Raspberry Pi 4 Model B (4GB)…