Jump to content

Recommended Posts

  • Administrators
Posted

The most efficient way I have found to backup my databases on my Cpanel Linux system is using a MySQL dump via a cron job.

 

Here is the syntax:

 

/usr/bin/mysqldump -u username -ppassword databasename | gzip -c > /home/Digitize Design/public_html/_db_backups/`date "+\%Y\%M\%d\%H\%m"`.filename.sql.gz

 

 

All you need to do is replace "username", "password", "databasename", and the location of where to save the file. As you can probably tell it will also gzip the backup to save disk space.

 

Click here to view the article

Posted

You can also make the date field dynamic.

 

Add date='date -I' to the start of the line then you can use the $date variable instead. This is what mine looks like and works perfectly.

 

date='date -I' ; mysqldump -u DBUSER -pDBPASSWORD DBNAME > /home/gadgetbi/public_html/BACKUP FOLDER/dbbackup_$date.sql ; gzip /home/gadgetbi/public_html/BACKUP FOLDER/dbbackup_$date.sql

  • Administrators
Posted

This is interesting I never used corn jobs to backup my DB but I might try it out.

How did you do it then?

  • Administrators
Posted

I've used the built in GoDaddy feature in the past, but then you HAVE to use the GoDaddy restore to restore them... I didn't like that

Posted

How did you do it then?

Manually just backed it up few times a week before installing a new mod or before making any change. I know its lacking on security it can always happen that my forum goes down but I didn't know i was able to do that with cron jobs I used cron jobs only for my php mafia script once so knew they do a few things but didn't know that they do this ;)
  • 3 weeks later...
Posted

Thanks for sharing this. I run a web hosting business, and use a cron job to back up our WHMCS database, similar to yours. Every 24 hours the cron jobs runs and then a copy of the database is stored in a secure environment off-site.

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.   Paste as plain text instead

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