How to use mysqldumper to auto-backup mysql database in Ubuntu server

Get mysqldumper

http://www.mysqldumper.net/

Powerful, easy to use, free, the best backup program!

Install perl for apache

Need to install perl to run the autobackup script

sudo aptitude install libapache2-mod-perl2

Config Apache
You need to add the following to your Apache-Config file (/etc/apache2/sites-available/default)

# Sample Apache-Config:
<Directory /home/www/mysqldumper/msd_cron>
    Options ExecCGI
    AddHandler cgi-script cgi pl
</Directory>

You need to change your web file folder: /home/www/

Restart Apache
sudo /etc/init.d/apache2 restart

Make permission for the pl files:
cd /home/www/mysqldumper/msd_cron
sudo chmod a+x *.pl

Audo Run the pl script by using crontag

Testing in your termianl:

perl /home/www/mysqldumper/msd_cron/crondump.pl -config=mysqldumper -html_output=0

Edit the crontab file to make the backup process automatically:

crontab -e

Make it run every day at midnight 23:30 PM automatically:
30 23 * * * perl /home/www/mysqldumper/msd_cron/crondump.pl -config=mysqldumper -html_output=0

Again, you need to change /home/www/ for your real web file folder.

You may need to install NTP and set up time zone for running crontab at the desired time:
Install Network Time NTP

apt-get install ntp

Configure Timezone
sudo dpkg-reconfigure tzdata

How to use unison to sychronize web files in Linux Server

See: http://thanhsiang.org/faqing/node/192