Here is a script that can make your life easier.

This script is used to save all your mysql databases and sending a ftp. He also runs a little history in case

If you do not have an FTP server: Here is how to install proftpd

Here's the script:

vi / data / backup / backup_mysql.sh
Copy and paste this:

/ bin / sh
# Backup mysql ftp
Mysql_user = "root"
Mysql_Paswd = "your password"
Mysql_host = "localhost"
# Emplacemment of different prog used, leave as is if you have not fiddled (if updatedb & locate)
MYSQL = "$ (which mysql)"
MYSQLDUMP = "$ (which mysqldump)"
CHOWN = "$ (which chown)"
CHMOD = "$ (which chmod)"
GZIP = "$ (which gzip)"

# Emplacemment the local file backup
DEST = "/ data / backup / backup"

# Directory where it puts the. Sql
DEST_mysql = "$ DEST / mysql"

# Current date
NOW = "$ (date +"% d-% m-% Y ")"

# Database backup has not separated by spaces
IGGY = ""

# We initialize variables
FILE = ""
DBS = ""

# we create the directory
[[ -d $ DEST_mysql] & & mkdir-p $ DEST_mysql | |:

# We limit access to the root uniquemment
# $ CHOWN $ 0.0-R DEST_mysql
# $ CHMOD 0600 $ DEST_mysql

# We list the database
DBS ="$($ MYSQL-u $ mysql_user-h $ p $-mysql_host Mysql_Paswd-Bl 'show databases') "

for db in $ DBS
do
    skipdb =- 1
    if [ "$ IGGY" = ""];
    then
        for i in $ IGGY
        do
            [ "$ Db" == "$ i"] & & skipdb = 1 | |:
        done
    fi

    if [ "$ skipdb" == "-1"] then
        FILE = "$ DEST_mysql / $ db. NOW.gz $"
        # We loop, and they dump all databases and it compresses
        $ Mysqldump-u $ mysql_user-h $ p $-mysql_host Mysql_Paswd $ db | $ GZIP -9> $ FILE
    fi
done

BACKUP # mysql databases via FTP
# number of days to keep backup
j = 15
j_a_delete = $ (date +% d-% m-% Y - date "$ d days ago")

# # Setup directories for FTP backup
DIR_BACKUP_mysql = $ DEST_mysql
DIR_DIST_BACKUP_mysql = '/ BACKUP / mysql /'

# Configure pass ftp
loginftp = "login"
motdepassftp = "pass"
host_ftp = "srvbackup.pouette.org"

# # Upload on FTP
yafc $ loginftp: $ motdepassftp @ $ host_ftp <<**
cd $ DIR_DIST_BACKUP_mysql
lcd $ DIR_BACKUP_mysql
mkdir $ NOW
cd $ NOW
put-r *
cd ..
rm-r $ j_a_delete
bye
**

# We delete all
cd $ DEST_mysql
rm-r *
Performing Rights:

chmod 700 / data / backup / backup_mysql.sh
It'll just automate it with crontab:

crontab-e
Then add this

00 03 * * * / data / backup / backup_mysql.sh>> / var / log / backup-mysql.log
The password is unencrypted! not cool for sure, here's a solution: here