Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    122

    offsite backups?

    So I have 2 virtual servers. I would want to use one for backup. Im interested only in MySQL backup on a remote SSH(2nd VPS). Anyone got some script for that?

  2. #2
    Join Date
    Mar 2005
    Location
    Maine, USA
    Posts
    302
    Here's one example script that I have used. Note the script has your password in it, so if someone gets ahold of the script, :|
    Make sure to chmod 600 mysqlbackup.sh script file.
    You'll also want to set up passwordless SSH logins via keys:
    http://www.petefreitag.com/item/532.cfm

    Code:
    #!/bin/bash
    
    DBNAME=databasename
    DBUSER=databaseuser
    DBPASS=password
     
    DATE=`date +%Y%m%d`
    
    mysqldump --opt -u $DBUSER -p$DBPASS $DBNAME > /home/username/mysql/mysql-database-username-backup-$DATE.sql
    
    tar -cz -C / home/username/mysql/mysql-database-username-backup-$DATE.sql > /home/username/mysql/mysql-database-username-backup-$DATE.sql.tar.gz
    
    rm /home/username/mysql/mysql-database-username-backup-$DATE.sql
    
    scp mysql-database-username-backup-$DATE.sql.tar.gz [email protected]:/home/user/whereyoustoreyourbackups/

  3. #3
    Quote Originally Posted by jzukerman View Post
    Here's one example script that I have used. Note the script has your password in it, so if someone gets ahold of the script, :|
    Make sure to chmod 600 mysqlbackup.sh script file.
    You'll also want to set up passwordless SSH logins via keys:
    petefreitag.com/item/532.cfm

    Code:
    #!/bin/bash
    
    DBNAME=databasename
    DBUSER=databaseuser
    DBPASS=password
     
    DATE=`date +%Y%m%d`
    
    mysqldump --opt -u $DBUSER -p$DBPASS $DBNAME > /home/username/mysql/mysql-database-username-backup-$DATE.sql
    
    tar -cz -C / home/username/mysql/mysql-database-username-backup-$DATE.sql > /home/username/mysql/mysql-database-username-backup-$DATE.sql.tar.gz
    
    rm /home/username/mysql/mysql-database-username-backup-$DATE.sql
    
    scp mysql-database-username-backup-$DATE.sql.tar.gz [email protected]:/home/user/whereyoustoreyourbackups/
    I don't think this is good for security...

Similar Threads

  1. Offsite Backups
    By GarrettReardon in forum Hosting Security and Technology
    Replies: 6
    Last Post: 08-27-2009, 03:51 PM
  2. anyone have offsite backups?
    By rubberman in forum Dedicated Server
    Replies: 11
    Last Post: 07-20-2005, 03:56 PM
  3. Offsite backups?
    By drsprite in forum Dedicated Server
    Replies: 5
    Last Post: 02-08-2004, 09:46 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
  •