MySQL DB backup shell script

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"

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment