This page covers the common migration scenarios for MediaWiki: importing content from other platforms, switching database backends, moving a wiki to a new server, and migrating the file repository layout.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/wikimedia/mediawiki/llms.txt
Use this file to discover all available pages before exploring further.
XML Dump Format
MediaWiki uses an XML-based dump format as its canonical interchange format for wiki content. Dumps contain page revisions, metadata, and optionally log entries and file upload information. Schema files are located indocs/export-*.xsd. The current format is defined in docs/export-0.11.xsd.
Creating an XML Dump
UsedumpBackup.php to export your wiki content:
Two-Pass Dumps (Large Wikis)
For very large wikis, use the two-pass dump method to reduce database load:Importing an XML Dump
importDump.php
Imports pages from an XML dump file into the current wiki.| Option | Description |
|---|---|
--dry-run | Parse the dump without writing to the database |
--namespaces <list> | Import only pages in these namespace numbers |
--rootpage <title> | Import pages as subpages of this title |
--uploads | Process file upload records in the dump |
--image-base-path <path> | Load actual files from this directory |
--username-prefix <prefix> | Prefix all usernames with this string |
--no-local-users | Do not associate edits with local accounts |
--skip-to <n> | Skip the first N pages (for resuming) |
--report <n> | Print a progress report every N pages |
Migrating from Another Wiki Platform
To migrate content from another wiki platform (Confluence, DokuWiki, TWiki, etc.) to MediaWiki:Convert content to MediaWiki XML format
Use a platform-specific converter to produce an XML dump compatible with MediaWiki’s import format. Tools include:
- DokuWiki to MediaWiki converter
- Confluence to MediaWiki exporter
- Generic converters listed on mediawiki.org/wiki/Converting_content_to_MediaWiki
Moving a Wiki to a New Server
Update LocalSettings.php
Update
$wgServer, $wgDBserver, and any absolute file paths in LocalSettings.php to reflect the new server.Run update.php
Even for a same-version migration, run
update.php to ensure all tables are consistent:Migrating Database Backends
MySQL to PostgreSQL (or vice versa)
MediaWiki does not provide a direct database-backend conversion script. The recommended approach is:- Export content as an XML dump from the source wiki
- Install a fresh MediaWiki with the new database backend
- Import the XML dump into the new installation
User account data (passwords, preferences, email addresses, watchlists) is not stored in XML dumps. You will need to either use the
user table dump from MySQL directly (with schema translation) or require users to re-register. Migrating the raw user table data across database backends is complex and not officially supported.File Repository Migration
Migrating File Layout
MediaWiki supports two file repository layouts:name— files stored flat by name (legacy)sha1— files stored in a directory tree based on SHA-1 hash (recommended)
migrateFileRepoLayout.php to migrate between layouts:
Copying Between File Backends
UsecopyFileBackend.php to copy files between different file backend configurations (e.g., local filesystem to Swift object storage):
Importing Images
Bulk-import files from a directory into the wiki’s file repository:User Migration
Merging User Accounts
If users exist in both source and destination wikis, use the UserMerge extension to merge duplicate accounts after import. When importing dumps with--username-prefix, users from the source wiki are created with a prefix (e.g., OldWiki>Username). After the import you can:
- Have users create new accounts on the destination wiki
- Use UserMerge to merge the prefixed historical account into the new account
- Or use
migrateUserGroup.phpto reassign group memberships
Renaming Users at Import Time
When importing from another wiki,--username-prefix prefixes all editor names to avoid conflicts:
