Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    156
    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:
    156
    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:
    166
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ellijay

    ellijay Active Member

    Joined:
    Dec 3, 2002
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    156
    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:
    151
    ... and chmod it appropriately world-not-readable (700/711).

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice