Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubuntu: Install automysqlbackup #MySQL #Markdown


AutoMySQLBackup with a basic configuration will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers.


  • Ubuntu server
  • MySQL


First create the backup folder.

sudo mkdir /var/backups/mysql

Install the latest version of automysqlbackup from the official website.

sudo mkdir /usr/local/src/automysqlbackup
cd /usr/local/src/automysqlbackup
sudo wget
sudo tar xvzf automysqlbackup-v3.0_rc6.tar.gz
sudo ./

Answer the install wizard as showed below.

global configuration diectory: default
directory for the executable: default

Add read permissios for all in the config folder.

cd /etc/automysqlbackup
sudo chmod a+r ./*

Update the automysqlbackup config file.

sudo vi /etc/automysqlbackup/automysqlbackup.conf

Set credentials and update the backup path.

# Username to access the MySQL server e.g. dbuser

# Password to access the MySQL server e.g. password

# Backup directory location e.g /backups

Unlock the latest backup in order to make backups for third party programs available

# Store an additional copy of the latest backup to a standard
# location so it can be downloaded by third party scripts.

Let's schedule the backup job by adding a daily cron script.

sudo vi /etc/cron.daily/automysqlbackup

With the following content.


/usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf

chown root.root /var/backup/mysql* -R
sudo chmod -R a-x+X /var/backup/mysql

Enable execution of the script for the owner.

sudo chmod o+x /etc/cron.daily/automysqlbackup

You can run the backup script manually.

cd /etc/cron.daily
sudo ./automysqlbackup

Checkout the backup folder.

cd /var//backup/mysql


How To Backup MySQL Databases on an Ubuntu VPS by Digital Ocean
How to back up MySQL databases using AutoMySQLBackup by A2 hosting automysqlbackup website


This comment has been minimized.

Copy link

@leomelzer leomelzer commented Mar 23, 2016

Thanks for the guide!

I ended up installing the packaged version, available from
It it somewhat more maintained and has some recent bug fixes.

To get rid of all the recommended packages for the installation (they total over 60 MB for me, whereas the script itself is only < 1 MB), run
sudo apt-get --no-install-recommends install automysqlbackup


This comment has been minimized.

Copy link

@chimit chimit commented Nov 27, 2016

There are two different paths in this article:




I think, the second one is correct. Other should be fixed.


This comment has been minimized.

Copy link

@oori oori commented Sep 23, 2018

The download link isn't current, you can try
sudo wget

or better, an updated fork here:
sudo wget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment