i need a backup script-my sql

Discussion in 'MySQL' started by enteens, Mar 7, 2008.

  1. #1
    i need automated my sql backup into another ftp
    pls help
     
    enteens, Mar 7, 2008 IP
  2. everythinghost

    everythinghost Peon

    Messages:
    445
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this is what i edited , it takes backups and send it to email.
    DBNAME=dbname

    DBPASS=dbpass

    DBUSER=dpuser

    #Keep the " around your address
    EMAIL="u@uuu.com"

    mysqldump --opt -u $DBUSER -p$DBPASS $DBNAME > backup.sql
    gzip backup.sql
    DATE=`date +%Y%m%d` ; mv backup.sql.gz $DBNAME-backup-$DATE.sql.gz
    echo 'Your mySQL Backup is attached' | mutt -a $DBNAME-backup-$DATE.sql.gz $EMAIL -s "MySQL Backup"


    set up a corn job for it for 24 hours
     
    everythinghost, Mar 7, 2008 IP
  3. fabriciogr

    fabriciogr Active Member

    Messages:
    958
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    73
    #3
    similar to the previous post but instead of emailing it you can scp it (same as ftp but safer) over to another machine:

    example:

    scp backup.sql

    you could timestamp the names to keep a nice historical repository
     
    fabriciogr, Mar 8, 2008 IP
  4. VernonK

    VernonK Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Also, over on PHPClasses there's a fairly new class for doing db backups... phpclasses dot org / browse / package / 4421.html

    Sorry... apparently I haven't posted enough to leave a live link yet so just get rid of the spaces and the dot of course.
     
    VernonK, Mar 10, 2008 IP