Jump to content

Recommended Posts

Hi,

 

I have several tatabases hosted on a server and I would like to be able to back them up atomatically (on schedule) without going to each one independently and exporiting a backup. I did some google searching and I see that there are few solutions out there. I would like hear the oppinions of this community and any good/bad experiences they had in doing something like this.

 

Any recommendatiions of software, prteferably free or unter $100 would be appreciated.

 

Thanks,

Pioneer

Link to comment
https://forums.phpfreaks.com/topic/283632-automatic-mysql-backup-solution/
Share on other sites

You don't have to pay extra money to approach that. I would recommend you using mysqldump via ssh tunnel to encrypt the dump data and a cron job to run the dump file on a schedule. Take a look at this my simple script written in BASH: 

#!/bin/bash

DBHOST="dbAddress"
DBUSER="dbUser"
DBPASS="dbPass"
DBNAME="dbName"
NOW=`/bin/date +%Y%m%d`
DIR=$(dirname $0)

if [ ! -d $DIR/$NOW ];then mkdir -p $DIR/$NOW;fi

ssh userName@domainName -p 22 mysqldump --host=$DBHOST --user=$DBUSER --password=$DBPASS --protocol=TCP \
--port=3306 --single-transaction ${DBNAME} > ${DIR}/${NOW}/$NOW.sql

tar zcf ${DIR}/db-$NOW.tgz ${DIR}/${NOW}/$NOW.sql

rm -rf ${DIR}/${NOW}

If you have more then one database hosted on the same DB sever you could use  a --all-databases flag.

You need to set up a trusted ssh connection between the client and server to allow logging into a host(server) without needing a password.

Edited by jazzman1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.