How to take backup of MySQL db using Shell scirpt
Create a file mysql_dbbackup.sh
#!/bin/bash
dbname="dbname"
today=$(date +"%Y-%m-%d_%H-%M-%S")
mkdir -p /home/user/dbBackup
echo "Backup mysql"
mysqldump -u root -p'password' $dbname > /home/user/dbBackup/$today.sql
echo "Mysql Back up completed"
0 comments:
Post a Comment