自动备份mysql数据库

注意:本文最后更新于 2328 天前,有关的内容可能已经发生变化,请参考使用。

Automysqlbackup是一个非常不错的轻量级Mysql自动备份脚本,你可以在这里下载到最新的版本,经过简单的配置之后添加到系统的周期执行列表中去即可简单实现mysql自动备份的功能。但是这么一个简洁而强大的工具在FreeBSD下使用的时候会提示如下的错误:


    ./automysqlbackup.sh.2.5: Command not found.

这是因为FreeBSD下默认是没有装bash的,而且即使通过PORTS安装之后相对于脚本中的位置也是不对的,要解决这个问题可以修改脚本中的bash
shell路径为#!/bin/sh,或者是用PORTS安装Bash之后将路径#!/usr/local/bin/bash

PS:备份脚本中要修改的内容一般只有如下


    # Username to access the MySQL server e.g. dbuser
    USERNAME=debian
    
    # Password to access the MySQL server e.g. password
    PASSWORD=
    
    # Host name (or IP address) of MySQL server e.g localhost
    DBHOST=localhost
    
    # List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
    DBNAMES="all"
    
    # Backup directory location e.g /backups
    BACKUPDIR="/srv/backup/db"
    
    # Mail setup
    # What would you like to be mailed to you?
    # - log   : send only log file
    # - files : send log file and sql files as attachments (see docs)
    # - stdout : will simply output the log to the screen if run manually.
    # - quiet : Only send logs if an error occurs to the MAILADDR.
    MAILCONTENT="log"
    
    # Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
    MAXATTSIZE="4000"
    
    # Email Address to send mail to? (user@domain.com)
    MAILADDR="maintenance@example.com"

「倘若有所帮助,不妨酌情赞赏!」

Holmesian

感谢您的支持!

使用微信扫描二维码完成支付


相关文章

发表新评论