Jump to content

Automatic, Scheduled Database Backup...


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.

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.