How to AUTO Backup your Database [Daily,Weekly And Monthly]

Discussion in 'Black Hat SEO' started by --sKy--, Aug 24, 2011.

  1. --sKy--

    --sKy-- Regular Member

    Aug 24, 2011
    Likes Received:
    1. We will need a script which will backup our db
    2. We need to set a cron job which will run this script at regular intervals.

    The script we will be using it is AutoMySQLBackup,search it on Google, it's free.

    Now what this script will do:
    Every day AutoMySQLBackup will run will dump your specified databases to the /backups/daily directory, it will rotate daily backups weekly so you should never have more than 7 backups in there..

    Every Saturday AutoMySQLBackup will again backup the databases you have chosen but they will be placed into /backups/weekly, these will be rotated every 5 weeks so there should never be more than 5 backups in there..

    Every 1st of the month AutoMySQLBackup will create a backup of all databases and place them into /backups/monthly. These will never be rotated so it will be up to you to do your own house keeping.

    I would suggest taking a copy of these DB backups offline every month or two so that if you have a hard drive failure you will be able to restore your database..

    Now the editing part, divided in two stages:

    Part 1
    1. Now after downloading AutoMySQLBackup, place it in your web directory OUTSIDE public_html so that nobody can access it except yours ex. backups

    2. Edit (at least) the following lines :-
    USERNAME=dbuser (The user must have at least select privileges to the databases) PASSWORD=password
    DBNAMES="DB1 DB2 DB3" (make sure to keep the quotes " " otherwise it won't work)
    [In case you are using it for mybb forum db, it should be only the name of your forum db and i recommend to use it for that only]

    3. Make the file executable :- chmod u+rwx (755)

    Part 2
    Now we need to set a cron job which will run it at a specified time: (to know how to set it please read Here)

    I am just providing here the most important part, command line (only this which many of you don't know to write it).
    In the cron command line, write
    Quote:/bin/sh /home/[your username]/backups/
    and save it to run once daily.
  2. BrandonD93

    BrandonD93 Newbie

    Jan 3, 2015
    Likes Received:
    Why do you need all that? Most hosts provide auto backups. If not, you can always switch to Wordpress and use an auto backup plugin.
  3. sashablack

    sashablack Elite Member

    Jan 8, 2010
    Likes Received:
    Agreed with this as well, why go through all this trouble when there are easier ways? this would definitely be for a pro..

  4. TheVigilante

    TheVigilante Jr. VIP Jr. VIP

    Aug 31, 2010
    Likes Received:
    Theatre of dreams :)
    why are you bumping 3+ year old threads??????????