<

Backing up MySQL Database using mysqldump & crontab

Open terminal and type:
sudo tcsh

pico /etc/crontab
or
nano /etc/crontab

And add one of the following lines depending on your situation. This schedule the backup on 1am every day.

Remote Host Backup with linked PATH to mysqldump:
0 1 * * * mysqldump -h mysql.host.com -uusername -ppassword --opt database > /path/to/directory/filename.sql

Remote Host Backup:
0 1 * * * /usr/local/mysql/bin/mysqldump -h mysql.host.com -uusername -ppassword --opt database > /path/to/directory/filename.sql

Local Host mysql Backup:
0 1 * * * /usr/local/mysql/bin/mysqldump -uroot -ppassword --opt database > /path/to/directory/filename.sql

(There is no space between the -p and password or -u and username - replace root with a correct database username.)

For Information Contact:
Comentum Corp
6222 Ferris Sq.
San Diego, CA 92121
Phone: 619-990-1212

Hours: Mon. - Fri., 9 a.m. - 5 p.m. PST

Contact Us »


Mobile App Development

iPhone, Google Android, BlackBerry, Windows Mobile
In-house development team.
San Diego, CA, USA.

Learn More

Web App Estimator

Select and unselect modules such CMS or eCommerce for your web application and watch the cost update in real time.

Try It »