Eureka!
Although it is true that using a function will return the correct order, for example:
SELECT DISTINCT ClassName FROM SiteTree ORDER BY REPLACE(ClassName,'','')
It turns out I was looking at the ENUM column (I forgot, I thought it was plain text), and so MySQL sorted according to the order of the elements in ENUM.
Thanks for the helpful tips.
Here's a reasonable solution, given the situation.
SELECT DISTINCT ClassName FROM SiteTree ORDER BY CAST(ClassName AS CHAR)
source share