title: Drop parent table in MySQL
body: <p>I've created two simple tables to ilustrate this question.</p>
  
  <pre><code>CREATE TABLE `child` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `father_id` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `IDX_22B354292055B9A2` (`father_id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  
  CREATE TABLE `father` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  
  ALTER TABLE `child`
    ADD CONSTRAINT `child_ibfk_1` FOREIGN KEY (`father_id`) REFERENCES `father` (`id`) 
    ON DELETE CASCADE;
  </code></pre>
  
  <p>Imagine that there are rows in the child table linked to the father table through the foreign key. </p>
  
  <p>If I delete a row in the father table that has rows linked to it in the child table, I can delete it anyway because I have "ON DELETE CASCADE" activated.</p>
  
  <p>The problem is that if I try to drop the father table, even if there are no rows neither on the father table nor on the child table, I get the following error message (in phpmyadmin):</p>
  
  <pre><code>#1217 - Cannot delete or update a parent row: a foreign key constraint fails
  </code></pre>
  
  <p>I tried this command:</p>
  
  <pre><code>SET foreign_key_checks = 0;
  </code></pre>
  
  <p>But the same error message appears. </p>
  
  <p>I could delete the whole database and create it again, but I don't want to do that if there is another solution (like ON DELETE CASCADE for the rows).</p>
  
  <p>Any suggestions?</p>