Backing up the wiki

Mediawiki Dump Generator
You can easily generate a database dump and file dump using the Mediawiki Client Tools' Mediawiki Dump Generator Python 3 dumpgenerator script, (full instructions are at this link). The result will include an XML dump with full page history, a dump of all images and files along with associated descriptions and a siteinfo.json file containing information about features, such as the installed extensions and skins.

e.g.

To dump a private wiki you will have to use a login that has at least read permission on the wiki.

e.g.

Restoring from backup
See MediaWiki.org, specifically Manual:Importing XML dumps and Manual:importImages.php.