dennypanther
dennypanther

Reputation: 63

Get Back ups of mySql database periodically

I have a mySql database which i need to get backup of data after every 24 hours. I don't have any idea about how to getting backups. How may i do this? please help..

Upvotes: 0

Views: 281

Answers (1)

user2441505
user2441505

Reputation:

Setup a server cron which runs mysqldump command after some interval (e.g. 24 hours)

mysqldump -hMY_HOST.COM -uDB_USERNAME -pDB_PASSWORD USERNAME_DATABASENAME > MysqlDump.sql

After creating dump file. Setup another cron to copy this dump to target server(preferably local) make this execute with same interval of above cron.

scp user@MY_HOST.COM:/some/path/file user2@MY_HOST2.COM:/some/path/file

NOTE: This commands may cause high server load (make sure you are executing them when server having minimum load)

Reference : http://www.bradtrupp.com/mysql-backup-cron.html

Upvotes: 1

Related Questions