简体   繁体   中英

Mediawiki database recovery

I had a small wiki I had hosted on a free host, but it seems it got spammed and the host took it down. They passed me a .sql file which was 2GB large. I am looking to set up another wiki, load the .sql into it and clean up the mess (or find the good stuff and copy it out).

I set up a new mediawiki, then I did the following:

mysql -u <user> -h mysql.domain.com -p<password> -e "drop database <dbname>;"
mysql -u <user> -h mysql.domain.com -p<password> -e "create database <dbname>;"
mysql -u <user> -h mysql.domain.com -p<password> <dbname> < file.sql

It takes a long time but I get no errors, then when I visit the mediawiki url I see:

A database query error has occurred. This may indicate a bug in the software.

Is this the wrong way to do this? What is the easiest way I can do this correctly?


Edit:

Now seeing:

A database query error has occurred. This may indicate a bug in the software.

Query:
SELECT page_id,page_namespace,page_title,page_restrictions,page_counter,page_is_redirect,page_is_new,page_random,page_touched,page_latest,page_len,page_content_model FROM `page` WHERE page_namespace = '0' AND page_title = 'Main_Page' LIMIT 1
Function: WikiPage::pageData
Error: 1054 Unknown column 'page_content_model' in 'field list' (mysql.domain.com)

There are some extensions to mass-delete pages but no one can "delete all pages after a certain date". Depending of the typology of the pages you have to delete, you can use:

It looks like the SQL backup you have is from an older version of MediaWiki, and is missing the page.page_content_model column (among others, likely).

To fix it, you will need to run the database schema update script ( maintenance/update.php ) that comes with your version of MediaWiki. You can either do this from the command line (recommended) or via the web upgrader (if you don't have command-line access).

See the links above for more details, but basically, for a typical MediaWiki install with command-line access, you just need to ssh to your web host, cd to the MediaWiki root directory, and run:

php maintenance/update.php

You'll see a lot of output describing what the script is doing (mostly checking for missing database columns and adding them), but hopefully no errors. If everything goes well, your wiki should now be ready to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM