How to alter an existing table in MySQL, setting foreign key to another table, using the command line?
If you have multiple foreign keys chained together and you get an error that ends with errorno 15x
it most likely means that there are other tables that are dependent on the foreign key that you're trying to drop.
To drop the foreign key when you get that error, you will need to do SET FOREIGN_KEY_CHECKS = 0;
and then you must first drop the foreign keys on the tables that don't have any other tables dependent on them. You can then successfully drop the foreign keys on the next table up in the chain and so on.
When you're done, make sure you run SET FOREIGN_KEY_CHECKS = 1;
again.