Manual:UpdateCollation.php

This script updates category collations. You need to run this script after $wgCategoryCollation has been changed. It is also needed to be run after upgrading to 1.17 and later from a version of MediaWiki before 1.17. Normally it is run as part of Manual:update.php.

If your category collations are messed up (aka things sort incorrectly in categories), you can use the  switch to forcibly fix all the category collations. See  for a list of all options.

The run time of the script depends on the number of rows in the categorylinks table, and for extremely large wikis may take over 24 hours. (A run on the English Wikipedia in September 2016 took around a week: T136150.) The script can process on the order of 10,000 rows per minute (depending on your setup); you can view the estimated number of rows on your wiki before running the real script by using. Wikimedia wikis of various sizes have been painlessly switched to different collations over time (T47443), just make sure to estimate how long the script will run before you start it.