To remove directories, run
git clean -f -d or git clean -fd

To remove ignored files, run
git clean -f -X or git clean -fX

To remove ignored and non-ignored files, run
git clean -f -x or git clean -fx

Check what's the CONSTRAINT name and the FOREIGN KEY name:

SHOW CREATE TABLE table_name;

Remove both the CONSTRAINT name and the FOREIGN KEY name:

ALTER TABLE table_name
  DROP FOREIGN KEY the_name_after_CONSTRAINT,
  DROP KEY the_name_after_FOREIGN_KEY;

Or simply run this if you know the foreign key name:

alter table footable drop foreign key fooconstraint

原文:https://stackoverflow.com/questions/838354/mysql-removing-some-foreign-keys