Skip to content

greenzwiz/mysql-cron-db-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

mysql-cron-db-backup-ubuntu14.04.1

###Create a directory to store backups.

mkdir -p /var/backups/db-backups

###Edit crontab file.

crontab -e

###Paste the following into the file at the end.

30 2 * * *  /usr/bin/mysqldump -u MYSQLUSER -pYOURPASSWORD YOURDATABASE | gzip > /var/backups/db-backups/`date +\%Y-\%m-\%d`.sql.gz

Replace the following with the appropriate options:

  • MYSQLUSER - your mysql user (usually root).
  • YOURPASSWORD - your mysql user (root) password.
  • YOURDATABASE - your database name.

Note: The above script will create a backup everyday at 2:30 AM. To view various crontab time options click here.

About

Simple mysql database backup cron job for ubuntu 14.04.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published