title: MySQL keeps complaining about foreign key. Error 150
body: <p>I'm trying to create a table with a foreign key to itself. I want to model a category that can be a child of another category. Here is my SQL:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `recipes`.`category` (
    `id` INT NOT NULL COMMENT '',
    `name` VARCHAR(60) NOT NULL COMMENT '',
    `description` VARCHAR(255) NULL COMMENT 'Description of the recipe category.',
    `parent_id` INT NULL COMMENT '',
    PRIMARY KEY (`id`)  COMMENT '',
    CONSTRAINT `parent_id`
      FOREIGN KEY (`id`)
      REFERENCES `recipes`.`category` (`id`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION);
  </code></pre>
  
  <p>However, MySQL keeps giving me an error:</p>
  
  <blockquote>
    <p>Can't create table 'recipes.category' (errno: 150)</p>
  </blockquote>
  
  <p>I'm trying to find out what I'm doing wrong, can anyone give me a hint? Docs say that:</p>
  
  <blockquote>
    <p>Cannot create table. If the error message refers to error 150, table
    creation failed because a foreign key constraint was not correctly
    formed.</p>
  </blockquote>
  
  <p>However, this does not help me much.</p>