Backup mysql database using cron job and bash script

Backup mysql database

First of all run this command
nano ~/.my.cnf
and write bellow codes

[mysqldump]
user=root
password=mypassword

after that create bkp.sh file in home directory
in bkp.sh file write below codes
mysqldump -u root db_name>db_name.sql

now open crontab and create a new job for backup to database
open crontab for this run below command
crontab -e
and create a new line
00 2 * * * /home/bkp/bkp.sh

and save this (ctrl+x and enter)

Comments