Back to Articles

How to Setup Automysqlbackup in Ubuntu 22

1 min read
asrar
How to Setup Automysqlbackup in Ubuntu 22

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

  2. 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

  3. Edit the configuration file:

    sudo nano /etc/automysqlbackup/automysqlbackup.conf

  4. Set the following variables in the configuration file:

    DBHOST=‘localhost’ DBUSER=‘root’ DBPASS=‘’ DBLIST=‘’ BACKUPDIR=‘/var/backup/mysql’

  5. 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.

IDCloudHost | SSD Cloud Hosting Indonesia

Share this article

Discussion

Join the discussion

Loading comments...