MYSQL : How to Backup specific database using mysqldump utility

preview_player
Показать описание
MYSQL : How to backup an specific databases from MySQL Server by mysqldump
*****************************************************************
mysqldump
*********
The mysqldump client is a backup program was written by Igor Romanenko.
It can be used to dump a database or a collection of databases for backup .
The dump typically contains SQL statements to create the table, populate it, or both.
However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

Syntax
*******

Create MYSQL backup user
*************************

MYSQL"angled bracket"
GRANT SELECT, SHOW VIEW, RELOAD, REPLICATION CLIENT, EVENT, TRIGGER ON *.* TO 'mysqlbackup'@'localhost';
GRANT LOCK TABLES ON *.* TO 'mysqlbackup'@'localhost';

MYSQL BACKUP SHELL SCRIPT
*************************

#!/bin/bash
export DUMP_PATH=/mysql/backup/
DATE=`date +%d%b%Y`

# Get the database list
do
echo "Performing backup of Database : $db"
done
RC1=$?
if [ $RC1 -ne 0 ];then
echo "Backup unsuccessful"
else
echo "Backup successful"
echo "Deleting the below old backup files"
find ${DUMP_PATH} -name "linux2_all_MySQLdump_*" -type f -mtime +3 -exec ls {} \;
if [ $? = 0 ];then
find ${DUMP_PATH} -name "linux2_all_MySQLdump_*" -type f -mtime +3 -exec rm {} \;
fi
fi

Рекомендации по теме