My post this time is about how to setup automysqlbackup in ubuntu 22. Please remember to adjust configuration per your needs.

  1. Install automysqlbackup:
sudo apt-get update
sudo apt-get install automysqlbackup
  1. Create a configuration file for automysqlbackup by copying the default configuration file:
sudo cp /etc/default/automysqlbackup /etc/default/automysqlbackup.bak
sudo cp /usr/share/doc/automysqlbackup/automysqlbackup.conf.gz /etc/automysqlbackup/automysqlbackup.conf.gz
sudo gunzip /etc/automysqlbackup/automysqlbackup.conf.gz
  1. Edit the configuration file:
sudo nano /etc/automysqlbackup/automysqlbackup.conf
  1. Set the following variables in the configuration file:
DBHOST='localhost'
DBUSER='root'
DBPASS=''
DBLIST=''
BACKUPDIR='/var/backup/mysql'
  1. Set up a cron job to run automysqlbackup at a specific time.

To edit the crontab file, run:

crontab -e

Add the following line at the bottom of the file to run automysqlbackup every day at 3:00 AM:

0 3 * * * /usr/sbin/automysqlbackup
  1. Save and close the crontab file.
  2. Test the configuration by manually running automysqlbackup:
sudo /usr/sbin/automysqlbackup

This will create a backup of all your MySQL databases in the BACKUPDIR directory specified in the configuration file.

You can now set up automysqlbackup to run automatically on a schedule, according to your backup needs.

Previous ArticleNext Article

Leave a Reply

Your email address will not be published. Required fields are marked *