Taking backup of mysql database using cron

Taking backup of mysql database using cron

Create a file called database_backup.sh and also an empty directory called mysql_backup. The database_backup.sh script should have the following info :

————————————————-
#!/bin/sh

date=`date ‘+%m-%d-%y’`
mysqldump -u database_username -pdatabase_password database_name > ~/mysql_backup/database_name.$date
————————————————-

Run the script that performs the backup job.

————————————————-
* 23 * * * your_userid /path/to/backup/script
————————————————-

Set this script up to run every night, etc. as a cron job. It will save an sql dump of your database every night in the mysql_backup.

Facebook Comments

More Stuff

Understanding Different Classifications of Shell Commands and Thei... When it comes to gaining absolute control over your Linux system, then nothing comes close to the command line interface (CLI). In order to become a L...
Programming Languages May Finally Be Reaching a Status Quo Apple's programming language Swift and the Android developer favorite Kotlin are two of the fastest growing languages of all time. But that growth mig...
How to Copy a File to Multiple Directories in Linux While learning Linux, it is always the norm for newbies to keep on typing several commands to accomplish a simple task. This is understandable especia...
Deal: Get Machine Learning and Artificial Intelligence Course (91%... Artificial Intelligence is the theory and realization of computer systems to carry out tasks that would practically call for human intelligence such a...
Spread the love

Posted by News Monkey