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.
-
Install automysqlbackup:
sudo apt-get update sudo apt-get install automysqlbackup
-
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
-
Edit the configuration file:
sudo nano /etc/automysqlbackup/automysqlbackup.conf
-
Set the following variables in the configuration file:
DBHOST=‘localhost’ DBUSER=‘root’ DBPASS=‘’ DBLIST=‘’ BACKUPDIR=‘/var/backup/mysql’
-
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
-
Save and close the crontab file.
-
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.
