+ Reply to Thread
Results 1 to 9 of 9
Like Tree3Likes
  • 1 Post By Stanz
  • 1 Post By *Face
  • 1 Post By simon.evanz48

Thread: [cPanel] Auto MySQL backup

  1. #1
    Stanz's Avatar
    Stanz is offline x10Hosting Member Stanz is an unknown quantity at this point
    Join Date
    Mar 2005
    Location
    South America
    Posts
    38

    [cPanel] Auto MySQL backup

    Download the script, attached below.

    Open the .php file in the attached .zip file & edit it.
    Upload the script to your site (create a new directory) for example yoursite.com/sqlbackup.
    CHMOD the new directory (folder) to 777.

    Go to your CPanel and click on Cron Jobs. Then click on Standard.

    Where it says "Command to run:" type
    /home/username/public_html/sqlbackup/backupdb.php
    Change the username to your username, and edit the path to where the script is located.

    Set the time you want the Cron Job to run in the Minute(s) and Hour(s) boxes.

    Warning: Do not do this in Hour(s) or Minute(s) or you account can be suspended for too much CPU usage. Here's the rest of the instructions:

    Now it's time to say when it will backup the DBs. If you want to run it once a week, pick a day from the Weekday(s) box. If you want to run it once a month, select a date from the Day(s) box and leave the Month(s) box at Every Month.

    Click Save Crontab and you're done.

    Note: This only works for cPanel software.
    You may use the script to backup if u dont have cPanel.
    But you wont be able to use this tutorial without cPanel.

    PS: You can make the script to email the backup,
    or upload it to the directory you set in the script.. (requires setup)
    This is only mySQL backup, not the whole site!!
    and em.. its very usefull for forums..
    Attached Files
    simon.evanz48 likes this.

  2. #2
    Corey's Avatar
    Corey is offline VPS Migration Professional Corey is a glorious beacon of lightCorey is a glorious beacon of light
    Join Date
    Dec 2004
    Location
    Northfield, NH
    Posts
    17,151
    Nice post, thanks Stanz

    -Corey

  3. #3
    Stanz's Avatar
    Stanz is offline x10Hosting Member Stanz is an unknown quantity at this point
    Join Date
    Mar 2005
    Location
    South America
    Posts
    38
    thanks
    anyway, you can also just run the script.
    if u want to backup manual...
    that might save the server..

  4. #4
    Origin's Avatar
    Origin is offline x10 Elder Origin is an unknown quantity at this point
    Join Date
    Mar 2005
    Location
    Silicon Valley, California
    Posts
    541

    Re: [cPanel] Auto MySQL backup

    Nice script :D

  5. #5
    brAddict is offline x10Hosting Member brAddict is an unknown quantity at this point
    Join Date
    Aug 2007
    Posts
    13

    Re: [cPanel] Auto MySQL backup

    Hi,

    I've done everything requested but the cron still doesn't work.

    Permissions are :

    0777 for the folder where the file is.
    0644 for the file itself (SQLBackup/backupdb.php)
    User created for the database backup has those privileges :

    select, insert, drop, create

    This is what I receive by email :

    /bin/sh: /home/braddict/public_html/SQLBackup/backupdb.php: Permission denied

    When I try to execute the file from the site itself, this is what it shows :

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.


    --

    Any ideas ??

  6. #6
    *Face is offline x10Hosting Member *Face is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    62

    Re: [cPanel] Auto MySQL backup

    The backupdb.php file needs execute permission, so it will probably need to be CHMOD to 755.
    karimirt47 likes this.

  7. #7
    masshuu's Avatar
    masshuu is offline Head of the Geese masshuu has a spectacular aura about
    Join Date
    Oct 2007
    Location
    Las Colinas, Tx
    Posts
    2,262

    Re: [cPanel] Auto MySQL backup

    hello, im getting the folowing email when its run with the cron, but it works fine when i run it via web browser.
    ALERT - function within blacklist called: mail() (attacker 'REMOTE_ADDR not set', file '/home/masshuku/private_html/backupdb.php', line 125)

  8. #8
    alquimistabiologico's Avatar
    alquimistabiologico is offline x10 Sophmore alquimistabiologico is an unknown quantity at this point
    Join Date
    Mar 2007
    Location
    Colombia
    Posts
    194

    Re: [cPanel] Auto MySQL backup

    Wow, that's a very usefull script.

    Thanks budy

  9. #9
    simon.evanz48 is offline x10Hosting Member simon.evanz48 is an unknown quantity at this point
    Join Date
    Jun 2011
    Location
    Wales, UK
    Posts
    24

    Re: [cPanel] Auto MySQL backup

    Thanks for your CRON example DB Backup script, I will give it a whirl to see what's what.
    dinomirt96 likes this.

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Full Backup from Cpanel (???)
    By draikun in forum Free Hosting
    Replies: 14
    Last Post: 06-05-2006, 07:57 PM
  3. in here MySQL version????
    By winUSD in forum Free Hosting
    Replies: 4
    Last Post: 05-09-2006, 08:44 AM
  4. Have a problem with my forum
    By tikloos in forum Scripts & 3rd Party Apps
    Replies: 43
    Last Post: 01-19-2006, 01:14 AM
  5. [cPanel] Forum Reinstall
    By Cylon in forum Tutorials
    Replies: 11
    Last Post: 03-31-2005, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers