SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict AndyH's Avatar
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Backup Database to another server

    Hello,

    What is the easiest way to backup a single database (all tables) to another server and even put a copy of the backup on the same server if possible.

    edit: via CRON

    I have root access to both servers.

    Also, can you make it so the command names the file "DD-MM-YY.sql". (or a gzip ...)

    Thanks alot.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Staffordshire, UK & Florida, USA
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use a shell script to backup my database which runs as a cron job. It runs mysqldump and bzips the file to a backups folder with the date appended to the filename. It looks like this (replace bits within angle brackets with your own values):

    #!/bin/sh
    date=`date "+%d%m%y"`
    /usr/local/mysql/bin/mysqldump --opt -u<username> -p<password> <database> | bzip2 -c > </path/to/backupfolder>/<filename>-$date.sql.bz2

    Hope this helps.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •