Run it from the command line like this: # automysqlbackup /etc/automysqlbackup/nf It’s safe and can’t hurt your databases, but the larger your databases the longer it takes to try different configuration tweaks. # Email Address to send mail to? First Runįor the first few runs, while you’re getting familiar with AutoMySQLBackup, I recommend backing up just one or two small databases. # - quiet : Only send logs if an error occurs to the MAILADDR. # - stdout : will simply output the log to the screen if run manually. # - files : send log file and sql files as attachments (see docs) I like to see the logfiles after every run, as this example shows: # What would you like to be mailed to you? There are two items that control notifications. everything older than 24hours will be removed. # If you want to keep only today's backups, you could choose 1, i.e. # Which day do you want weekly backups? (1 to 7 where 1 is Monday) # If the chosen day is greater than the last day of the month, it will be done # Which day do you want monthly backups? (01 to 31) This example performs monthly backups on the 3rd of every month, weekly backups on Saturdays, daily backups are kept for 7 days, weekly backups are kept for 14 days, and monthly backups for 30 days. ().ĬONFIG_db_exclude=('information_schema' 'test_db' 'demo_db' ) # List of DBNAMES to EXLUCDE if DBNAMES is empty, i.e. empty, if you want to backup all databases One of my servers hosts over 150 virtual Web hosts, and each one has its own MySQL database, so this is a huge timesaver for me: # List of databases for Daily/Weekly Backup e.g. Then if there are any you want to exclude, just create an exclude list. If you have a lot of them, then leaving CONFIG_db_names=() empty copies all of them. You have a lot of control over which databases are backed up. Your server is localhost, and you need to create or choose a directory to store your backups in: # Host name (or IP address) of MySQL server e.g localhost passwordĬONFIG_mysql_dump_password=`cat /etc/psa/.psa.shadow`
Instead, use the encrypted password: # Password to access the MySQL server e.g. You can dump this password in plain text with this command if you need to recover it: # /usr/local/psa/bin/admin -show-passwordīut you can’t use the plain text password in your AutoMySQLBackup configuration. Starting with version 10.2 the Plesk admin password is encrypted in /etc/psa/.psa.shadow. It is better to use a different MySQL user, like one you have created with minimal privileges just for AutoMySQLBackup, but if that is not possible then you can’t use the plain-text admin password. There is a complication if you are using Parallels Plesk 10.2 or newer on your server, and you want to authenticate with the admin user. passwordĬONFIG_mysql_dump_password='sekkritpassword' # Password to access the MySQL server e.g.
First you need to select a MySQL user that has, at a minimum, SELECT privileges, and then enter that user and user’s password: # Username to access the MySQL server e.g. The configuration file is large and well-commented, and you need to change only a few things to start making and testing your backups. Then you will have a copy of the original for reference, and your working configuration file. Replace “nf” with whatever you want to name your configuration file. These are run from the directory where you unpacked the tarball: # chown root:root automysqlbackup
If the installation script fails you can easily install AutoMySQLBackup manually by following these steps. Then your next step is to run install.sh, and this requires root privileges.
It may not tell you everything you need to know, so hopefully this article will fill the gaps. Next, read the README because it contains installation instructions and other useful information. Now you should have the automysqlbackup-v3.0_rc6 directory with six files in it: automysqlbackup, nf, CHANGELOG, install.sh, LICENSE, and README. Getting AutoMySQLBackupĭownload AutoMySQLBackup from Sourceforge, and then unpack the tarball: $ tar zxvf automysqlbackup-v3.0_ Then you can copy the tarballs to other media, and encrypt them if you wish. AutoMySQLBackup dumps your databases at whatever intervals you desire, and rolls them up into compressed tarballs. Its only dependency is the mysqldumpcommand, which comes with mysql-client. AutoMySQLBackup is a clever script that takes the pain out of setting up automated incremental daily, weekly, and monthly backups of MySQL databases.