用于日常数据库备份的bash shell文件-作为CRON作业运行
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用于日常数据库备份的bash shell文件-作为CRON作业运行相关的知识,希望对你有一定的参考价值。
Creates a daily backup and deletes any backup older than 60 days.Replace:
*DB_USER
*DB_PASSWORD
*DB_NAME
*/path/to/backup
with your actual database name, credentials and path to where you want your backup to live.
Last note: you don't necessarily need to wrap your password in quotes. Some characters will cause it to break without them, however.
#/bin/bash /usr/bin/mysqldump --user=DB_USER --password='DB_PASSWORD' --databases DB_NAME | gzip > /path/to/backup/DB_NAME-`date +%Y%m%d%H%M`.sql.gz find /path/to/backup -name "*.gz" -mtime +60 -exec /bin/rm {} ;
以上是关于用于日常数据库备份的bash shell文件-作为CRON作业运行的主要内容,如果未能解决你的问题,请参考以下文章