How to Backup MySQL using automysqlbackup

automysqlbackup is a utility program that is available in the Ubuntu repositories.
This utility can be scheduled to automatically perform backups at regular intervals.
To install, type the following into the terminal:

$ sudo apt-get install automysqlbackup
A following prompt will ask you which mail configuration you prefer.
Select “internet site” if you’re going to set up email notification.
If not, just select “no configuration”. I personally went for “no configuration” to leave things unchanged. Start automysqlbackup: $ sudo automysqlbackup

A folder structure and initial backups will be performed immediately.
The default location for backups is /var/lib/automysqlbackup.
List contents of this directory to see the folder structure:

$ ls /var/lib/automysqlbackup

You should see three directories for the daily, weekly and monthly
backups being performed automatically by automysqlbackup and a subdirectory
for each database containing the respective gzipped SQL dump. The configuration file for automysqlbackup is located at /etc/default/automysqlbackup.
Open it in your favorite editor:

sudo vi /etc/default/automysqlbackup

This file assigns many variables by the MySQL file located at /etc/mysql/debian.cnf.
It reads the user, password, and databases to be backed up. All default configurations
can be left intact. You are now able to sleep well at night, knowing that your customer’s
data will be backed up at regular intervals.