Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples.
TL;DR: MySQL refuses to drop the last index whose leading columns hold a foreign key's columns, and turning off foreign_key_checks does not change that on MySQL 8.4. If the foreign key is going too, drop it and the index in one ALTER TABLE . If the key stays, add the replacement index in the same statement as the drop. The trap is an index MySQL swapped in for its own without telling you, which turns a routine rollback into error 1553.
MySQL error 1553, Cannot drop index 'customer_id': needed in a foreign key constraint , means the index you are dropping is the last one MySQL can use to enforce a foreign key, and the fix depends on whether that foreign key should survive the migration. If the key is going too, drop both in one statement. If the key stays, put a replacement index in first.…