简体   繁体   中英

Restoring MediaWiki wiki with XAMPP from copy of /opt/lampp/ directory

I was hosting a webserver with XAMPP for a LAN wiki on Ubuntu. I managed to get it up and running and invested a lot of time into writing content and pages for the Wiki.

Some point later I installed Php and suddenly the Apache Web Sever in XAMPP was no longer starting. I then uninstalled Php but still had the same issue. I decided to to do a clean install of XAMPP, making a copy of my old /opt/lampp/ directory. I thought it would be enough to re-install XAMPP and copy over the /opt/lampp/htdocs and /opt/lamp/var/mysql into the newly installed XAMPP directory.

When I try to run XAMPP now Apache starts but MySQL database does not.

When I enable showing exception details in the LocalSettings.php of my Wiki and try to access via web browser I get the following error message:

MediaWiki internal error.

Original exception: [XVZpYg4zO1Jsk5cKtKVvcgAAAAM] /mywiki/ Wikimedia\Rdbms\DBConnectionError from line 1213 of /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)
Backtrace:
#0 /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(758): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /opt/lampp/htdocs/mywiki/includes/GlobalFunctions.php(2637): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)
#2 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(integer)
#3 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(410): LCStoreDB->get(string, string)
#4 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(456): LocalisationCache->isExpired(string)
#5 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(332): LocalisationCache->initLanguage(string)
#6 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(273): LocalisationCache->loadItem(string, string)
#7 /opt/lampp/htdocs/mywiki/languages/Language.php(4537): LocalisationCache->getItem(string, string)
#8 /opt/lampp/htdocs/mywiki/languages/Language.php(262): Language::getFallbacksFor(string)
#9 /opt/lampp/htdocs/mywiki/languages/Language.php(223): Language::newFromCode(string)
#10 /opt/lampp/htdocs/mywiki/includes/ServiceWiring.php(120): Language::factory(string)
#11 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(430): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#12 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(414): Wikimedia\Services\ServiceContainer->createService(string)
#13 /opt/lampp/htdocs/mywiki/includes/MediaWikiServices.php(508): Wikimedia\Services\ServiceContainer->getService(string)
#14 /opt/lampp/htdocs/mywiki/includes/Setup.php(790): MediaWiki\MediaWikiServices->getContentLanguage()
#15 /opt/lampp/htdocs/mywiki/includes/WebStart.php(77): require_once(string)
#16 /opt/lampp/htdocs/mywiki/index.php(39): require(string)
#17 {main}

Exception caught inside exception handler: [XVZpYg4zO1Jsk5cKtKVvcgAAAAM] /mywiki/ Wikimedia\Rdbms\DBConnectionError from line 1213 of /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)
Backtrace:
#0 /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(758): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /opt/lampp/htdocs/mywiki/includes/GlobalFunctions.php(2637): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)
#2 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(integer)
#3 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(355): LCStoreDB->get(string, string)
#4 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(273): LocalisationCache->loadItem(string, string)
#5 /opt/lampp/htdocs/mywiki/languages/Language.php(4537): LocalisationCache->getItem(string, string)
#6 /opt/lampp/htdocs/mywiki/languages/Language.php(262): Language::getFallbacksFor(string)
#7 /opt/lampp/htdocs/mywiki/languages/Language.php(223): Language::newFromCode(string)
#8 /opt/lampp/htdocs/mywiki/includes/ServiceWiring.php(120): Language::factory(string)
#9 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(430): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#10 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(414): Wikimedia\Services\ServiceContainer->createService(string)
#11 /opt/lampp/htdocs/mywiki/includes/MediaWikiServices.php(508): Wikimedia\Services\ServiceContainer->getService(string)
#12 /opt/lampp/htdocs/mywiki/includes/cache/MessageCache.php(126): MediaWiki\MediaWikiServices->getContentLanguage()
#13 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionRenderer.php(311): MessageCache::singleton()
#14 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionRenderer.php(51): MWExceptionRenderer::reportOutageHTML(Wikimedia\Rdbms\DBConnectionError)
#15 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(98): MWExceptionRenderer::output(Wikimedia\Rdbms\DBConnectionError, integer)
#16 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(172): MWExceptionHandler::report(Wikimedia\Rdbms\DBConnectionError)
#17 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(144): MWExceptionHandler::handleException(Wikimedia\Rdbms\DBConnectionError)
#18 [internal function]: MWExceptionHandler::handleUncaughtException(Wikimedia\Rdbms\DBConnectionError)
#19 {main}

Is there anyway I can recover this?

So after spending a bit of time messing around trying various things I found a solution that allowed me to recover the Wiki. I'll post what I did here in case it helps anyone in the future. It involves the following steps:

  • Exporting the tables of the MySQL Mediawiki database
  • Clean installing XAMPP
  • Clean install Mediawiki and create a new wiki project
  • Deleting the MySQL database of the new project
  • Importing old tables to new project

Since I'm a complete noob with regards to webservers/MySQL this is probably not the quickest or most efficient method but it worked.

Starting Point:

  • Something in your XAMPP configuration is messed up which causes MySQL Database not to start. As such phpMyAdmin can not be started from the web browser

  • You are reasonably confident the MediaWiki MySQL database itself is functional and exists (on XAMPP 7.3.7-1 for Ubuntu the following files should be located in the /opt/lampp/var/mysql dir: ib_logfile0 , ib_logfile1 and ibdata1 . There should be also be a folder in there with the name of your Mediawiki.

Solution:

1) Exporting the tables of your Mediawiki database

  • Make a copy of your entire /opt/lampp/ directory somewhere safe.
  • Uninstall XAMPP sudo ./opt/var/uninstall and remove the dir rm -rf /opt/lampp
  • Reinstall XAMPP (use the same version you used previously)
  • Copy your backed up versions of ib_logfile0, ib_logfile1 and ibdata1 into /opt/lampp/var/mysql/
  • From your backup copy the entire folder backup/lampp/var/mysql/mywiki into the newly install XAMPP dir /opt/lampp/var/mysql/
  • Start XAMPP - everything should work. Go to phpMyAdmin and you should see the database of your wiki. Go to it and export it as SQL format. Save the .sql file.

2) Clean install XAMPP once again (delete everything in opt/lampp)

3) Follow the instructions to install MediaWiki with XAMPP

4) Do the swap

  • As per step 3) you should now have a clean Mediawiki install with a brand new wiki linked to a new database.
  • Go to phpMyAdmin, select database and then "check all" tables in the database and delete (drop) them.
  • Now have an empty database. In phpMyAdmin click Import and upload your .sql file generated from step 1).

Try starting XAMPP and (hopefully) load the wiki!

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