Ivan
Ivan

Reputation: 20101

How to migrate only newer posts from one Mediawiki MySQL to another?

I dumped the MySQL database that one instance of Mediawiki uses. I migrated this database to another machine and reinstalled Mediawiki. The old machine is still running and getting new posts. How can I migrate only these new posts to the new machine? If a just do a new dump and migrate it to the new machine, it will work?

Upvotes: 1

Views: 55

Answers (1)

leo
leo

Reputation: 8520

If there are no edits on your new wiki, you can just go ahead and do the full dump/import again:

At your old server:

 mysqldump --user=USERNAME --password=PASSWORD --host=DB.MYWIKI.COM wikidb > dbdump.sql

At your new server:

 mysql --user=USERNAME --password=PASSWORD wikidb < dbdump.sql

This will overwrite existing all tables.

If, for some reason, you need to export/import pages revised later than a certain date, it might be easiest to use the Recent Changes API to get a list of all pages recently changed, e.g. action=query&list=recentchanges&rcprop=title, and then export those pages via Special:Export. You will get an XML dump, that you can then import via Special:Import. When doing the dump, you can even specify that you only want changes after a certain date, like this:

https://en.wikipedia.org/w/index.php?title=Special:Export&pages=Main_Page%0AStack%20overflow&offset=2014-10-27T20:25:56Z&limit=5

Note the odd separator between pagenames: %0A. See https://www.mediawiki.org/wiki/Manual:Parameters_to_Special:Export for more options when doing the export

Upvotes: 1

Related Questions