2021-03-02 MediaWiki MySQL数据库备份及恢复

MySQL
Automysqlbackup
查看软件包

root@XXX:~# apt show automysqlbackup
Package: automysqlbackup
Version: 2.6+debian.4-3
Priority: extra
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers 
Original-Maintainer: Thomas Goirand 
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 58.4 kB
Depends: bsd-mailx | mailx, default-mysql-client | virtual-mysql-client
Recommends: mutt
Homepage: http://sourceforge.net/projects/automysqlbackup/
Download-Size: 14.4 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu groovy/universe amd64 Packages
Description: daily, weekly and monthly backup for your MySQL database
 automysqlbackup creates backup every day, week and month for all of your MySQL
 database, to a configured folder. There's nothing to do but to install this
 package, and you'll rest assured that you have a way to go back in the history
 of your database.
 .
 This package may be unsafe if untrusted users may create databases and if no
 check on the syntax of the name of them is performed.

安装:

# apt install automysqlbackup

数据库都将被保存在/var/lib/automysqlbackup/:

root@vultr:~# find /var/lib/automysqlbackup/
/var/lib/automysqlbackup/
/var/lib/automysqlbackup/monthly
/var/lib/automysqlbackup/daily
/var/lib/automysqlbackup/daily/wikidb
/var/lib/automysqlbackup/daily/wikidb/wikidb_2021-03-02_01h49m.Tuesday.sql.gz
/var/lib/automysqlbackup/weekly
/var/lib/automysqlbackup/weekly/wikidb

手动备份:

# automysqlbackup

恢复数据库:

gunzip < /var/lib/automysqlbackup/weekly/my_wiki//var/lib/automysqlbackup/daily/wikidb/wikidb_2021-03-02_01h49m.Tuesday.sql.gz|mysql -uUSER -pPASSWORD my_wiki

你可能感兴趣的:(2021-03-02 MediaWiki MySQL数据库备份及恢复)