ThirstyGrunt
05-23-2007, 10:29 PM
I need a way to regularly backup mysql db's from a shared account.
Any suggestions?
Preferably to an external server, but this is mainly to prevent corruption.
Thanks!
Mike
BMurtagh
05-24-2007, 12:00 AM
look into setting up a cronjob with the appropriate timeperuid & rsync the file to the external server
Burhan
05-24-2007, 01:48 AM
mysqldump + rsync + cron ... and a sprinkling of bash should do the trick.
ThirstyGrunt
05-24-2007, 02:01 AM
I know nothing about rsync and mysqldump other than rsync backs things up and mysqldump has to do with exporting mysql dbs. Any nice informational links, possibly?
Thanks again
Well, you can do it with one line:
mysqldump DATABASE | gzip | ssh USER@REMOTE_SERVER 'cat - > ~/backup.mysql.gz'
That will dump the database named DATABASE, compress it, and SSH it to REMOTE_SERVER and storing it in backup.mysql.gz in your home directory. You have to properly configure your my.cnf on the source server to grant access to DATABASE and set up correct SSH keys to establish the connection to REMOTE_SERVER without a password. Then it can go into your crontab just like that.
streaky
05-25-2007, 02:34 PM
I prefer to use http://sourceforge.net/projects/automysqlbackup/ and rsync on cron.