title: Drop Column with foreign key in MySQL
body: <p>I have the following 2 tables:</p>
  
  <pre><code>CREATE TABLE `personal_info` (
   `p_id` int(11) NOT NULL AUTO_INCREMENT,
   `name` text NOT NULL,
   `initials` text NOT NULL,
   `surname` text NOT NULL,
   `home_lang` int(11) NOT NULL,
   PRIMARY KEY (`p_id`),
   KEY `home_lang` (`home_lang`),
   CONSTRAINT `personal_info_ibfk_1` FOREIGN KEY (`home_lang`) REFERENCES `language_list` (`ll_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1
  
  CREATE TABLE `language_list` (
   `ll_id` int(11) NOT NULL AUTO_INCREMENT,
   `name` text NOT NULL,
   PRIMARY KEY (`ll_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1
  </code></pre>
  
  <p>I am trying to remove a column from a table with the following:</p>
  
  <pre><code>ALTER TABLE `personal_info` DROP `home_lang`
  </code></pre>
  
  <p>But cannot do it since I recieve this error:</p>
  
  <pre><code>#1025 - Error on rename of '.\MyDB\#sql-112c_82' to '.\MyDB\personal_info' (errno: 150)
  </code></pre>
  
  <p>I have tried to first remove the index and then remove the column with this:</p>
  
  <pre><code>ALTER TABLE personal_info DROP INDEX home_lang
  </code></pre>
  
  <p>But then I get the following error:</p>
  
  <pre><code>#1553 - Cannot drop index 'home_lang': needed in a foreign key constraint 
  </code></pre>
  
  <p>So I tried to drop the foreign key:</p>
  
  <pre><code>ALTER TABLE personal_info DROP FOREIGN KEY home_lang
  </code></pre>
  
  <p>But received this error:</p>
  
  <pre><code>#1025 - Error on rename of '.\MyDB\personal_info' to '.\MyDB\#sql2-112c-8d' (errno: 152)
  </code></pre>
  
  <p>I have also tried to first set all the values to null:</p>
  
  <pre><code>update personal_info set home_lang = null
  </code></pre>
  
  <p>But then received this error:</p>
  
  <pre><code>#1452 - Cannot add or update a child row: a foreign key constraint fails (`MyDB`.`personal_info`, CONSTRAINT `personal_info_ibfk_1` FOREIGN KEY (`home_lang`) REFERENCES `language_list` (`ll_id`))
  </code></pre>
  
  <p>And now I am stuck. I have tried a few things but just cannot get the column removed. I am not allowed to alter the DB in any way other than removing the column. </p>