Auto back up MYSQL Database using cron

phpMyAdmin is the easiest tool to backup databases but if you want to automate the process simply add this line to cron

sudo crontab -e

mysqldump -uUSER -pPASS database_name > /var/www/database.sql

change USER, PASS and database_name, you can of course change the location of where to save the file to as well

If adding to cron don't forget the time settings!

example to back up specific database evry day at 2am

0 2 * * * mysqldump -uUSER -pPASS database_name > /var/www/database.sql
Print Friendly, PDF & Email

More Like This


Categories


Linux
  • Post a comment