Topic on Project:Support desk

Where does Mediawiki store page content?

5 (talkcontribs)

After an unsuccessful attempt to install Ubuntu 12.10 I reinstalled 12.04 first and then Mediawiki (after MySQL, apache2 and PHP5).

Though I have a backup of the old database, wikidb, I can not get Mediawiki to show the old content. For some reason my new tables are called w????* whereas my old tables are called w????_*.

So I am renaming the old tables to the new naming scheme. But this is not what I really would like to do. Browsing through the old tables has not given me any hint about where the old pages' content is stored. Can you help me?

The same applies to images. (talkcontribs)


Each page has a record in the table "page". The page content is stored in the database table "text" (there you find the actual text).

What have you done to set up MediaWiki on the new server? Have you run the installer? The different database table names look to me like you did exactly that and during this process you defined another table prefix than you had before. In that case a possible fix would be to change the prefix back to the old one in LocalSettings.php.

I would set up a wiki from backup differently:

You say you have a backup of your wikidb. Is it a SQL dump, a .sql file? If so, import the contents of such a file on the new MySQL server. You will then get a new DB with exactly the same content, which you had before. Then copy all your old MediaWiki files in place (including LocalSettings.php). If you have changed the MySQL username, password or host, adjust these and things should be going.

This post was posted by, but signed as (talkcontribs)

Thanks for your prompt answer. OK, let me take the issues one by one.

Yes, the tables page and text have the OK content.

Yes, I used the installer. I am not aware of a change of prefix, but that is probably what I have done besides selecting a different language as the Wiki language.

The backup is a complete set of MySQL database files.

The new Mediawiki is of a different version, so some of the old tables generate errors.

But, all the Mediawiki files are lost.

Unless I get it working I will have to regenerate the pages from *page and *text. As the content was not large at all this is feasible. (talkcontribs)

So your database is OK, but the files from the folders extensions/, images/ and skins/ are missing.

Two possiblities: You can continue as I wrote above, by setting up the wiki again and using the old database. Go through the Update Tool and the database should work with the new version of MediaWiki. However, you then will still get errors concerning the files, which MediaWiki thinks are there, but which in fact are not (images/, possibly your skin files/, if you used a skin, which does not come with MediaWiki by default). There is a maintenance script called rebuildImages.php, but I don't know, if it reliably removes missing images from the database.

Second possibility: Set up a new, empty wiki, take the contents from the text table (take care to pick the newest revision for each page) and paste them in the new installation. Upload images again (if any).

Since you say you only have very few pages, I would go with the second possibility and paste the contents from the database dump. (talkcontribs)

Problem solved!

The solution was to reset the language in LocalSettings.php back to "en-gb". Then to add the column rev_sha1 to the old table wtphrrevision holding all the revisions.

Interesting, how comes? Should it not be possible to change the language dynamically?