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.
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 https://kent.dl.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz
sudo tar xvzf automysqlbackup-v3.0_rc6.tar.gz
sudo ./install.sh
Answer the install wizard as showed below by accepting the default entries. Alternatively, enter your own custom path.
global configuration directory:
directory for the executable:
Add read permissions for all in the config folder.
cd /etc/automysqlbackup
sudo chmod a+r ./*
Update the automysqlbackup config file.
sudo nano /etc/automysqlbackup/automysqlbackup.conf
Set credentials and update the backup path.
# Username to access the MySQL server e.g. dbuser
CONFIG_mysql_dump_username='root'
# Password to access the MySQL server e.g. password
CONFIG_mysql_dump_password='[password]'
# Backup directory location e.g /backups
CONFIG_backup_dir='/var/backups/mysql'
# List of DBNAMES to EXLUCDE if DBNAMES is empty, i.e. ().
CONFIG_db_exclude=( 'information_schema' 'performance_schema' 'mysql' 'slow_query_log' )
Let's schedule the backup job by adding a daily cron script.
sudo nano /etc/cron.daily/automysqlbackup
With the following content.
#!/bin/sh
/usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf
chown root.root /var/backups/mysql* -R
sudo chmod -R a-x+X /var/backups/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/backups/mysql