How to convert your MediaWiki database to SQLite?

Sometimes, when you have a very popular MediaWiki web site with a lot of articles, the database becomes quite large. Slow MySQL queries could be generated and this will cause a negative impact to your web server performance.

In such a case there are two possible solutions. You can either decrease the database size by removing the unnecessarily articles or you can migrate your MySQL database to SQLite.

Prior to proceed with the migration it is recommended to create a full backup of your MediaWiki web site:

http://www.siteground.com/tutorials/cpanel_crystal/backup.htm

Use an SSH connection to your server. Alternatively, if you have a really large database with a lot of records in thetext table (total size above 100MB) download the web site backup to your local computer and set the web site using your local web server.

Run the following commands through a terminal window:

cd your_current_wiki_folder

php maintenance/dumpBackup.php --full --uploads > wiki-backup.xml

tar -cipzf wiki_images.tgz images/

Replace your_current_wiki_folder with your actual MediaWiki directory.

Download the latest stable version of MediaWiki from the following URL:

http://www.mediawiki.org/wiki/Download

Install it as per the manual installation instructions posted in the SiteGround's MediaWiki tutorial:

http://www.siteground.com/tutorials/mediawiki/mediawiki_installation.htm

Pick SQLite as the Database type.

Complete the installation.

Navigate to the new MediaWiki installation folder.

Copy the wiki-backup.xml file under it.

Execute the following command:

php maintenance/importDump.php wiki-backup.xml

The import procedure can take some time. It depends on the amount of the MediaWiki pages.

The main page should be regenerated manually. Once the above procedure is completed all the other pages will appear in the new installation.

At the end you should import the images. Navigate to the new MediaWiki folder and copy the wiki_images.tgz file under it. Then run the following commands:

mkdir temp
cd temp/
cp ../wiki_images.tgz ./
tar -xzvf wiki_images.tgz
cd ..
mkdir tempimg
cp temp/images/*/*/* tempimg
php maintenance/importImages.php tempimg/

Your new MediaWiki installation is ready to be used.

If you are a SiteGround customer and you have difficulties with the above procedure you can always post anExclusive Support Services request in the Script, Component or Module Configuration Assistance category:

Our Senior Support Team members will complete the SQLite migration for you.

Additional MediaWiki optimization tips can be found in the SiteGround's Website Optimization tutorial:

http://www.hostlantern.com/tutorials/websiteperformance/optimize_mediawiki.htm

You need help with an application? hostlantern is specialized in hosting and supporting more than 200 scripts. Sign up for our web hosting services and let us help you with your application, 24/7!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to assign users to groups in MediaWiki?

If you want to grant extra permissions to some of your registered users in MediaWiki, you have to...

How to get complex math formulas working in MediaWiki

This article explains how to overcome issues with Math formulas not properly displaying in...

I am getting ‘libgomp: Thread creation failed: Cannot allocate memory’ when uploading images to MediaWiki.

This error message appears when you try to upload an image with large dimensions to a MediaWiki...

How to run the MediaWiki update script through a browser?

By default, when upgrading MediaWiki, you have to run the update.php file from a command prompt....

How to remove the ‘Powered by SiteGround cPAddons’ message from the MediaWiki footer?

hostlantern offers a customized cPAddons tool for easy automatic installation of several...

Powered by WHMCompleteSolution