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

docker: subuids subgids

Docker error if your id is not included in the subuid & subgid files $ docker container lsEmulate Docker CLI…

Updating $PATH for Laravel in Ubuntu 20.04

In order to get #laravel command to work make sure its included in the $PATH $ composer global require laravel/installer…

Convert MySQL db character encoding set

Converting mysql character set type

Satellite Server: katello-service

Time for some upgrades and backups of the satellite server, first inspect the current services running and enabled [root@rhel75lab ~]#…