简体   繁体   English

Mediawiki数据库恢复

[英]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. 他们传给我一个2GB大的.sql文件。 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). 我希望设置另一个wiki,将.sql加载到其中并清理混乱(或找到好东西并将其复制出来)。

I set up a new mediawiki, then I did the following: 我建立了一个新的mediawiki,然后我做了以下事情:

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: 这需要很长时间,但我没有错误,然后当我访问mediawiki网址时,我看到:

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). 看起来你的SQL备份来自较旧版本的MediaWiki,并且缺少page.page_content_model列(可能还有其他)。

To fix it, you will need to run the database schema update script ( maintenance/update.php ) that comes with your version of MediaWiki. 要修复它,您需要运行您的MediaWiki版本附带的数据库架构更新脚本maintenance/update.php )。 You can either do this from the command line (recommended) or via the web upgrader (if you don't have command-line access). 您可以从命令行(推荐)或通过Web升级程序 (如果您没有命令行访问权限)执行此操作。

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: 有关更多详细信息,请参阅上面的链接,但基本上,对于具有命令行访问权限的典型MediaWiki安装,您只需要ssh到您的Web主机, cd到MediaWiki根目录,然后运行:

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. 如果一切顺利,您的维基现在应该可以使用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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