Jump to content

Automatic, Scheduled Database Backup...


Kingskin

Recommended Posts

Hi,

 

I'd like to run daily backups of my MySQL database. I understand I can backup to a directory on my server using something like this with CPanel & cron:

 

date=`date -I`; mysqldump -uDBUSER -pDBPASS --all-databases | gzip > /home/CPANEL/xbackup_$date.sql.gz

 

However, I have a problem. Firstly, I get 150MB of disk space and my DB is a few megs and growing, so running daily backups to the server will max out my space in no time at all. I'm assuming this can be overcome by just storing the latest backup, ie:

 

date=`date -I`; mysqldump -uDBUSER -pDBPASS --all-databases | gzip > /home/CPANEL/xbackup.sql.gz

 

but I don't know for sure if that would work as I dont really know anything about the commands being used or cron jobs.

 

What I really want to do however is automatically backup the database and then save it to my PC each night as my hosting is free and slightly undreliable - if the server disappears for any reason I dont want to lose everything. Is this possible, and how would I do it (please be straightforward in your reply, I know very little about this topic!). Up to now ive been manually doing it with phpMyAdmin but i'm sure there must be another way.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/2893-automatic-scheduled-database-backup/
Share on other sites

  • 1 month later...

I see this post is old but I too would love a solution like this.

 

My question is what happens if my hard drive (I only have one) crashes then those backups I had stored anyways is gone.

 

I prefer to dl them to my computer with plenty of space and then I occasionally burn them to DVD-R.

 

My server is A Fedora Linux server.

 

My system at home is a workstation running Win XP.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.