XMPP JavaScript Library

Small Linux shell script to backup MySQL Database

Linux, Sachin Puri, 2012-01-27 16:29:37

This shell script can be used to take mysql database backup. To make backup process automatically you have to call this shellscript using Cron Job.

#!/bin/sh
#MySQL Database Backup Script
#-----------------------------

#Config
DB="database" #Database to backup
USER="user" #Your MySQL User
PASS="password" #Your MySQL Password
BACKUP_DIR="/root/backup" #Path to your backup directory
MYSQL_BIN_DIR="/var/mysql/bin" #Path to your MySQL bin folder
#Config

DT=`date '+%d_%b_%Y_%H_%M_%S'`
FILE=$BACKUP_DIR/$DB'_DB_BK_'$DT.sql

$MYSQL_BIN_DIR/mysqldump $DB > $FILE -u $USER -p$PASS
gzip $FILE

 

Add Your Comment
   
    Yes! I want to receive all comments by email

  by sss on 17-May-2019 12:09 pm
i really like this article please keep it up. dvd duplication
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Mildred Schultz on 16-May-2019 03:08 pm
I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. auto locksmith Federal Way
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Donald Hoffman on 14-May-2019 09:17 pm
All your hard work is much appreciated. Nobody can stop to admire you. Lots of appreciation. Auto Insurance Marble Falls
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by aa on 12-May-2019 02:26 am
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! ruit picking baskets
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by aaa on 10-May-2019 02:46 pm
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! bike shop
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by aa on 06-May-2019 12:01 pm
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. ebony porn reviews
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by csa on 05-May-2019 01:24 am
The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface. Distributor Kutus Kutus
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Haider ali on 04-May-2019 01:31 pm
Thanks, that was a really cool read! Distributor Kutus Kutus
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by aaa on 01-May-2019 06:09 pm
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! Buy 100 Euro Bills
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by AA on 30-Apr-2019 02:59 pm
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! اختبار قدرات تجريبي
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Anonymous on 28-Jan-2012 08:49 pm
Thanks for the script.
  • Reply
  •  8 Like
  •  3 Dislike
  • Report