1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

MySQL Backup Question

Discussion in 'Plesk for Linux - 8.x and Older' started by DoobyWho, Sep 11, 2005.

  1. DoobyWho

    DoobyWho Guest

    0
     
    I have two MySQL backup questions:


    (1) Is there a way to do an incremental MySQL backup, specifically where each database is it's own .SQL file?

    I know you can do an incremental backup and I know you can backup each to it's own .sql, but both together?



    (2) How can this be modified to work for RHE3? I found this script and it looks like a decent mysql backup script if the above question isn't possible.

    #!/bin/sh
    # mysqlback.sh -- do mysql database dumps -- t|<evans
    # Sun Jun 22 11:00:35 EDT 2003
    ##############################
    PATH=/usr/local/bin:$PATH
    BACKDIR=/data/backups/mysql
    DAYSBACK=7
    export PATH BACKDIR DAYSBACK
    #
    ########################
    # clean up backups older
    # than $DAYSBACK
    ########################
    cd $BACKDIR
    find . -mtime +$DAYSBACK -exec rm -f {} \;
    #########################
    # get a list of databases
    #########################
    cat <<EOF > tmpsql$$
    show databases;
    EOF
    mysql -u root --password=XXXXX < tmpsql$$ | sed '/Database/d' >
    dblist$$
    ############################
    # back each one up in turn;
    # --opt locks tables during
    # backup, so no need to shut
    # down mysql; but access will
    # be denied during backup
    #
    # we also pipe through gzip
    ############################
    for DB in `cat dblist$$`
    do mysqldump -u root --password=XXXXX --opt --flush-logs $DB | gzip
    \
    > $DB.`date '+%m.%d.%y'`.gz
    done
    ###################
    # empty the logfile
    ###################
    rm /var/mysql/mysql.log.*
    cat /dev/null > /var/mysql/mysql.log

    #######
    # email
    #######
    ls -l $BACKDIR | /usr/bin/mailx -s "MySQL Backup Completed" admin
    ##########
    # clean up
    ##########
    rm dblist$$ tmpsql$$
     
  2. DoobyWho

    DoobyWho Guest

    0
     
    any ideas?
     
  3. DoobyWho

    DoobyWho Guest

    0
     
    *last bump*
     
Loading...