Server TO(Technical Operation)/Linux2018. 6. 13. 01:01MySQL & MariaDB crontab을 이용한 자동 백업

백업 bash 스크립트 작성 root@0acd15c1ee60:/# vi autoBackupDB.sh #!/bin/bash backupPath=/home/dalgoo/server/backup/ backupDate=$(date +%Y%m%d_%H%M%S) USERNAME=디비아이디 PASSWORD=디비비번 DATABASE=디비이름 mysqldump -u$USERNAME -p$PASSWORD $DATABASE > $backupPath/$backupDate'_'$DATABASE'.sql' zip -j $backupPath$backupDate'_backupDB.zip' $backupPath$backupDate'_'$DATABASE'.sql' rm $backupPath$backupDate'_'$DATABASE'.s..

image