Knowledge Base Article

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 the text 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 an Exclusive 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.siteground.com/tutorials/websiteperformance/optimize_mediawiki.htm



Rating

Please indicate if this article was helpful for you.

rating :  5.0 from 5
views :  1224
votes :  5

Related Articles

Views

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!