The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Daily user MySQL backups

Discussion in 'General Discussion' started by ellijay, Jun 23, 2003.

  1. ellijay

    ellijay Active Member

    Joined:
    Dec 3, 2002
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Is there any way a user can script a daily backup of their MySQL databases into their home diretory?

    cPanel.net Support Ticket Number:
     
  2. ellijay

    ellijay Active Member

    Joined:
    Dec 3, 2002
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Bump for help...

    cPanel.net Support Ticket Number:
     
  3. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Create a mysql-backup.sh file within the users directory. Place the following inside:
    Code:
    #!/bin/sh
    
    date=`/bin/date +%m-%d-%Y`
    
    /usr/bin/mysqldump -uUSERNAME -pPASSWORD database > /home/username/database-backup-$date.sql
    Add the following cron entry:
    Code:
    0 1 * * * /bin/sh /home/username/mysql-backup.sh 2>&1 >/dev/null
    This will run backups at 1 AM every day.
     
  4. ellijay

    ellijay Active Member

    Joined:
    Dec 3, 2002
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Thank you SO much! Excellent.
    :)

    cPanel.net Support Ticket Number:
     
  5. mweb

    mweb Member

    Joined:
    Mar 11, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    ... and chmod it appropriately world-not-readable (700/711).

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page