Backup of the database work

First, the need for database backup:
A, providing high availability and recoverability for enterprise data, protect the stability of the system.
b, data backup can reduce the time of a disaster. Cost recovery.
Second, the method of database backup:
● enterprise work, we need to back up the database, the most common method is to customize the script with regular tasks to achieve full standby database. Specific methods are as follows:
A, edit a custom script
VI /data/scripts/mysql-bak.sh
# / bin / the bash!
DATENOW = date +%Y%m%d
the DIR = / Data / Backup / dbbackup / "$ DATENOW"
DATETIME = date +%H%M
IF [-d "! the DIR $ "]
the then
mkdir -p / Data / Backup / dbbackup /" $ DATENOW "
Fi
/ usr / bin / the mysqldump -uroot--p 'password' -h 10.2.6.11 -A -B --single-transaction | gzip> "$ the DIR" /mysql$DATETIME.sql.gz
olddate = $ (DATE -d "-6 Days" "the Y +% m% D%")
CD / Data / Backup / dbbackup
for Folder in $ (LS -d / )
do
[Folder% {$ /
} $ -LT-olddate] &

b, a new timer task:
30 2 * / bin / /data/scripts/mysql-bak.sh the bash> / dev / null 2>. 1 &
such 2:30 data per day will be a full database backup.
c, the results show:
[[email protected] dbbackup] LS #
20,190,724 20,190,725 20,190,726 20,190,727 20,190,728 20,190,729 20.19073 million
● Of course, we can also backup data by another method. Use this database plug navicat exclusive backup
a, of course, is to install navicat, the client can be downloaded from the Internet.
B, connect to database
C, click on the automatic operation, select the database to be backed up
Backup of the database work
d, follow the prompts, can back up data to the local computer.
Backup of the database work
This is the method I used in the work of two database backup.

Guess you like

Origin blog.51cto.com/13043960/2424731