title: Error #1064 near "REFERENCES" while adding a foreign key
body: <p>I keep getting error 1064 while trying to create a foreign key:</p>
  
  <pre><code>ALTER TABLE `zajimavost`
      ADD CONSTRAINT FK_zaj_bod 
      FOREIGN KEY def_bod
        REFERENCES `bod`(`gid`)
        ON UPDATE CASCADE ON DELETE CASCADE;
  </code></pre>
  
  <p>It complains:</p>
  
  <pre><code>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'REFERENCES `bod`(`gid`)
        ON UPDATE CASCADE ON DELETE CASCADE' at line 4
  </code></pre>
  
  <p>I tried it with or without the backticks, the problem is always the same.</p>
  
  <p>My tables:</p>
  
  <pre><code>CREATE TABLE `zajimavost` (
   `zaj_id` int(11) NOT NULL,
   `lok_id` int(11) NOT NULL,
   `nazev` varchar(255) COLLATE utf8_czech_ci NOT NULL,
   `kategorie` int(11) NOT NULL DEFAULT '1',
   `datace_od` int(11) NOT NULL DEFAULT '31',
   `datace_do` int(11) NOT NULL DEFAULT '60',
   `def_bod` int(11) DEFAULT NULL,
   PRIMARY KEY (`zaj_id`),
   KEY `ck_zaj_lok` (`lok_id`),
   KEY `zaj_id` (`zaj_id`),
   KEY `FK_zaj_kat` (`kategorie`),
   KEY `FK_zaj_bod` (`def_bod`),
   CONSTRAINT `FK_zaj_kat` FOREIGN KEY (`kategorie`) REFERENCES `kategorie` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
   CONSTRAINT `fk_zaj_lok` FOREIGN KEY (`lok_id`) REFERENCES `lokalita` (`lok_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci
  
  CREATE TABLE `bod` (
   `gid` int(11) NOT NULL AUTO_INCREMENT,
   `geom` point DEFAULT NULL,
   `radius` int(4) NOT NULL DEFAULT '50',
   PRIMARY KEY (`gid`)
  ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci
  </code></pre>
  
  <p>There are data in the tables.</p>
  
  <p>So how to solve it?</p>