How to backup database (cpanel server)

Posted by hbhb, 01-13-2008, 09:19 PM
Hi, I have a crucial database (mysql). My server is running cpanel. It has daily backup but it is not enough as it is running a lot of transaction daily. I would like to run the backup to backup database only every 30 mins using cronjob. How do i do that in crontab. I have root access to the server. Thanks a lot

Posted by psyxakias, 01-13-2008, 09:58 PM
If you're worried for HDD failure, you may want to consider to use 2 similar HDDs with RAID-1 (mirroring). Even if the one fails, the data will remain to the other and you'll be able to replace the HDD and rebuild array. If you're generally worried about the database and you would prefer to back it up every 30 minutes, you may use mysqldump & crontab: mysqldump: http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html crontab: http://www.adminschoice.com/docs/crontab.htm If you need any further information, don't hesitate to ask. Thank you.

Posted by karem, 01-14-2008, 12:51 AM
mkdir /backup/mysql then chmod 0755 /backup/mysql then vi /scripts/mysqlbackup #!/bin/bash /usr/bin/rsync -arzgopu /var/lib/mysql /backup/mysql then :wq then chmod 755 /scripts/mysqlbackup echo "0 */6 * * * /scripts/mysqlbackup" >> /var/spool/cron/root this cron to take it every 6 hour u can change it if u have any issue just till me Regards Karem

Posted by fog, 01-14-2008, 01:31 AM
I haven't the slightest bit of experience doing it on cPanel, but if this database is absolutely mission-critical and you're backing it up very often, it may make sense to look into replication (if, of course, you have a spare server somewhere): http://dev.mysql.com/doc/refman/5.0/en/replication.html It's generally talked about in the context of distributing the load across multiple servers, but it can be used for backup purposes, too. With the ability to do 'asynchronous' syncing, you could keep a Linux box in your basement or something and just sync the two every 30 minutes (or more!). Again, I have no experience doing it on cPanel (and frankly, I doubt many people have?), but it seems like it could potentially be less cumbersome.

Posted by david510, 01-14-2008, 02:42 AM
hbhb, You need a single database backup and each backup file as a separate dump file?

Was this answer helpful?

 Print this Article

Also Read

MySQL error code: 2006

Posted by Glostar, 04-18-2009, 03:54 AMI update MySQL from version 4 to 5.0.67-community. Now, I...

clamscan command

Posted by persianwhois, 04-21-2009, 05:04 AMCan you please provide a clamscan ssh command for...

frequent rebooting - what can cause this?

Posted by Premier, 07-14-2007, 12:28 AMI have a server that is monitored with a system that...

Limiting bandwidth for non logged in users

Posted by Dasweb, 03-04-2010, 08:16 PMCould anyone point me in the right direction to achieve...

Websites hacked, can't find the file

Posted by crk91, 04-20-2009, 09:30 PMI don't know how this happened but someone got into my VPS...