I'm sure MySQL has the ST_Distance method for ordering by the distance?
order by st_distance(geom1, geom2)
And for calculating the distance, you can reference this blog:
It shows how to define a user function (haversine) for making the calculations.