Administrators Nathan Posted February 19, 2012 Administrators Posted February 19, 2012 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 Quote
Creaky Posted February 19, 2012 Posted February 19, 2012 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 Quote
Administrators Tony Posted February 19, 2012 Administrators Posted February 19, 2012 @Creaky - How often are your backups? Quote
Creaky Posted February 20, 2012 Posted February 20, 2012 @Creaky - How often are your backups? Mine run every 24 hours, normally between 1&2 in the morning. Quote
Shole Posted February 21, 2012 Posted February 21, 2012 This is interesting I never used corn jobs to backup my DB but I might try it out. Quote
Administrators Nathan Posted February 21, 2012 Author Administrators Posted February 21, 2012 This is interesting I never used corn jobs to backup my DB but I might try it out. How did you do it then? Quote
Administrators Tony Posted February 21, 2012 Administrators Posted February 21, 2012 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 Quote
wonderzz Posted February 22, 2012 Posted February 22, 2012 I will definitely have to try this out. Looks pretty simple to do. Quote
Shole Posted February 22, 2012 Posted February 22, 2012 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 Quote
MustangV10 Posted March 11, 2012 Posted March 11, 2012 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.