title: Query points within a given radius in MySQL
body: <p>I have created the following MySQL table to store latitude/longitude coordinates along with a name for each point:</p>
  
  <pre><code>CREATE TABLE `points` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(128) NOT NULL,
    `location` point NOT NULL,
    PRIMARY KEY (`id`),
    SPATIAL KEY `location` (`location`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  </code></pre>
  
  <p>I am trying to query:</p>
  
  <ul>
  <li>all points within an <i>n</i> mile radius of a given point;</li>
  <li>the distance of each returned point from the given point</li>
  </ul>
  
  <p>All of the examples I have found refer to using a minimum bounding rectangle (MBR) rather than a radius. The table contains approximately 1 million points, so this need needs to be as efficient as possible.</p>