备份MySQL数据库与Ubuntu上的AutomySQLBackup

AutoMySQLBackup是一个免费的开源工具,它可以自动备份MySQL服务器上托管的所有数据库,并以不同的时间间隔进行备份。

它不仅可以自动备份MySQL数据库,还具有许多功能,如电子邮件通知、增量备份、备份压缩和加密。

第2步:配置automysqlbackup

AutoMySQLBack的默认配置目录为:

/etc/automysqlbackup/

创建一个新的配置文件。

sudo nano /etc/automysqlbackup/automysqlbackup.conf

将下面的内容添加到文件中并保存。

CONFIG_mysql_dump_username='root'
CONFIG_mysql_dump_password='root_password'
CONFIG_mysql_dump_host='localhost'
CONFIG_backup_dir='/var/backup/db'
CONFIG_do_monthly="01"
CONFIG_do_weekly="5"
CONFIG_rotation_daily=6
CONFIG_rotation_weekly=35
CONFIG_rotation_monthly=150
CONFIG_mysql_dump_port=3306
CONFIG_mysql_dump_compression='gzip'

现在如果要手动运行备份,只需在下面键入命令。

sudo automysqlbackup

要每天自动运行备份,请运行以下命令。

sudo ln -s /usr/sbin/automysqlbackup /etc/cron.daily/

在下面的文件夹中可以查看用于手动运行的备份作业。

/var/lib/automysqlbackup

第1步:安装automysqlbackup

运行以下命令以安装AutomySQLBackup工具。

sudo apt-get update
sudo apt-get install automysqlbackup

在安装过程中,系统会提示我们选择邮件配置。
如果我们要设置电子邮件通知,请选择Internet站点。
如果没有,那么只需选择无配置。

Please select the mail server configuration type that best meets your needs.
No configuration:
Should be chosen to leave the current configuration unchanged.
Internet site:
Mail is sent and received directly using SMTP.
Internet with smarthost:
Mail is received directly using SMTP or by running a utility such
as fetchmail. Outgoing mail is sent using a smarthost.
Satellite system:
All mail is sent to another machine, called a 'smarthost', for delivery.
Local only:
The only delivered mail is the mail for local users. There is no network.
General type of mail configuration:
                    No configuration
                    Internet Site
                    Internet with smarthost
                    Satellite system
                     Local only
         <Ok>                                       <Cancel>

选择选项后,选择“OK”以继续安装。

日期:2020-07-07 20:55:02 来源:oir作者:oir