ellijay

Active Member
Dec 3, 2002
38
0
156
Is there any way a user can script a daily backup of their MySQL databases into their home diretory?

cPanel.net Support Ticket Number:
 

ciphervendor

Well-Known Member
Aug 26, 2002
1,052
0
166
Create a mysql-backup.sh file within the users directory. Place the following inside:
Code:
#!/bin/sh

date=`/bin/date +%m-%d-%Y`

/usr/bin/mysqldump -uUSERNAME -pPASSWORD database > /home/username/database-backup-$date.sql
Add the following cron entry:
Code:
0 1 * * * /bin/sh /home/username/mysql-backup.sh 2>&1 >/dev/null
This will run backups at 1 AM every day.
 

mweb

Member
Mar 11, 2003
23
0
151
Originally posted by ciphervendor
/usr/bin/mysqldump -uUSERNAME -pPASSWORD database
... and chmod it appropriately world-not-readable (700/711).

cPanel.net Support Ticket Number: