Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Friday, August 24, 2007

Moving MediaWiki to another machine

I've moved my MediaWiki from the faster and noisier machine to the slower but silent Mini-ITX machine. The wiki seems working with only minor formatting errors which was due to customized design. I should have store the customized images inside of the MediaWiki so that it will be easy to migrate to another server.

The only problem I had was moving MySQL databases. I've tried to use mysqldump to backup and restore the wiki database. However, whenever I tried to restore the database into the new server, it kept displaying either database not found error or permission error. Eventually I've used phpMyAdmin to move the database after I've changed the 1MB upload file size limit on PHP.

Tips on moving a MediaWiki

  • Read this first: Manual:Moving a wiki
  • Check upload_max_filesize, memory_limit and post_max_size in php.ini if you're moving large MySQL database using phpmyadmin.
  • If you installed a extensions, make sure to copy the extension directory as well as any change made to LocalSetting.php.
  • And of course, check MediaWiki, PHP and MySQL versions.

Friday, March 23, 2007

Upgrading MediaWiki 1.8.4 to 1.9

I've just upgrade my MediaWiki from 1.8.4 to 1.9.3. Here is step-by-step instruction how I upgrade the Wiki.

  1. Make a full backup of the database.
    From shell,
    mysqldump -u wikidbuser -p --opt
    --databases wikdb > wikidb-backup.sql
    If you don't have insufficient privilege to MySQL database, you might get following errors:
    mysqldump: Got error: 1044: Access denied for
    user 'wikidbuser'@'localhost' to database 'wikidb'
    when using LOCK TABLES
    You may have to use MySQL root account to backup or without --opt option. Since the MediaWiki installation, I've actually used MySQL so I've done full backup.
    mysqldump -u root -p --add-drop-table
    --all-databases > backup.sql
    Of course, you can also use phpMyAdmin to all the work.
  2. Make a backup the MediaWiki directory.
    Make sure at least you backup AdminSettings.php file, LocalSettings.php file, images folder, and extensions directory. I've just done full backup.
    cp -a /var/www/mediawiki
    ~/Backup/mediawiki.backup
  3. Upgrading WikiMedia
    Getting the newest WikiMedia source
    wget http://mirror/mediawiki-1.9.3.tar.gz
    tar xvfz mediawiki-1.9.3.tar.gz
    Updating files
    /bin/cp -R mediawiki-1.9.3.tar.gz /var/www/mediawiki
  4. Run maintenance script.
    cd /var/www/mediawiki/maintenance
    php update.php
    I've just renamed LocalSettings.php and re-run the web installation. And move back LocalSettings.php file. Check Special:Version for MediaWiki version.
  5. Copy back extensions and images folder if necessary.

I've had problem with file permission on MediaWiki files which were own by apache:apache and I was installing from user account. If you have root account, it shouldn't be a problem.

Wednesday, December 20, 2006

Select column by comparing two table

Suppose you want to select column entries in a table based on anther table, how do you use SELECT by comparing two tables?

SELECT users.name FROM users, order WHERE order.custid = users.id

Syntax is just like a selecting column from table. Except you now have to use name of table with column name.