<>linux mysql Automatic daily backup

<> Create directory
mkdir -p /data/mysqlbak/data mkdir -p /data/mysqlbak/scripts mkdir -p
/data/mysqlbak/logs
<> Create script

cd /data/mysqlbak/scripts
vi backup.sh
#!/bin/bash # Backup directory BACKUP_ROOT=/wzq/data/mysqlbak
BACKUP_FILEDIR=$BACKUP_ROOT/data # current date DATE=$(date +%Y%m%d) mysqldump -uroot
-p123456 --default-character-set=utf8 -q --lock-all-tables --flush-logs -E -R
--triggers -B db-name | gzip > $BACKUP_FILEDIR/db-name_$DATE.sql.gz echo
----------$BACKUP_FILEDIR/db-name_$DATE.sql.gz COMPLETE---------- echo "done"
<> Set permissions
chmod 777 backup.sh
<> Add to scheduled task
00 2 * * * /data/mysqlbak/scripts/backup.sh > data/mysqlbak/logs/backup.log
2>&1

Technology
©2019-2020 Toolsou All rights reserved,
html Writing about cherry trees , Writing about cherry trees It's unexpected Python Cherry tree (turtle The gorgeous style of Library ) Browser kernel ( understand )HashMap Explain in detail java Four functional interfaces ( a key , simple )os Simple use of module Some East 14 Pay change 16 salary , Sincerity or routine ?