Lab-verifiedReproduced and fixed on MySQL 8.4.13 · 2026-11-29 · container image mysql:8.4
InnoDB requires an index on the columns of every foreign key, on the child side and on the referenced parent side. If you drop the index a foreign key depends on, MySQL stops with ERROR 1553 and names the index.
The fix is either to drop the foreign key first, or to give it another index to use before dropping the old one. The message is in English even with Korean or Japanese lc_messages.
01Dropping the index MySQL created for the foreign key
When you add a foreign key without an index, MySQL creates one with the constraint's name, here fk_orders_customer. Dropping that index while the foreign key exists fails.
Setup
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT,
CONSTRAINT fk_orders_customer FOREIGN KEY (customer_id) REFERENCES customers (id));Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)ALTER TABLE orders DROP INDEX fk_orders_customer;ERROR 1553 (HY000): Cannot drop index 'fk_orders_customer': needed in a foreign key constraintSELECT index_name, column_name FROM information_schema.statistics WHERE table_schema = 'lab_a' AND table_name = 'orders' ORDER BY index_name;+--------------------+-------------+
| INDEX_NAME | COLUMN_NAME |
+--------------------+-------------+
| fk_orders_customer | customer_id |
| PRIMARY | id |
+--------------------+-------------+
2 rows in set (0.00 sec)ALTER TABLE orders DROP FOREIGN KEY fk_orders_customer;Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0information_schema.statistics shows the index fk_orders_customer on customer_id. If you really want to remove it, drop the foreign key first: ALTER TABLE orders DROP FOREIGN KEY fk_orders_customer. After that the index can be dropped.
ALTER TABLE orders DROP INDEX fk_orders_customer;Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 002Dropping a composite index the foreign key is using
idx_cust_date (customer_id, order_date) starts with customer_id, so the foreign key uses it and MySQL did not create a separate one. Dropping it to replace it with another index gives 1553.
Setup
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT, order_date DATE,
KEY idx_cust_date (customer_id, order_date),
CONSTRAINT fk_orders_customer FOREIGN KEY (customer_id) REFERENCES customers (id));Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)ALTER TABLE orders DROP INDEX idx_cust_date;ERROR 1553 (HY000): Cannot drop index 'idx_cust_date': needed in a foreign key constraintCREATE INDEX idx_customer ON orders (customer_id);Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0Create the new index first: CREATE INDEX idx_customer ON orders (customer_id). Now the foreign key can use it, and dropping idx_cust_date succeeds. The table ends with idx_customer and PRIMARY, and the foreign key stays.
ALTER TABLE orders DROP INDEX idx_cust_date;
SELECT index_name, column_name FROM information_schema.statistics WHERE table_schema = 'lab_a' AND table_name = 'orders' ORDER BY index_name;Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
+--------------+-------------+
| INDEX_NAME | COLUMN_NAME |
+--------------+-------------+
| idx_customer | customer_id |
| PRIMARY | id |
+--------------+-------------+
2 rows in set (0.00 sec)03Dropping the parent's unique key that a child references
login_log.email references users.email, which is backed by the unique key uq_email. 1553 also applies on the parent side, so ALTER TABLE users DROP INDEX uq_email fails.
Setup
CREATE TABLE users (id INT PRIMARY KEY, email VARCHAR(100), UNIQUE KEY uq_email (email));
CREATE TABLE login_log (id INT PRIMARY KEY, email VARCHAR(100),
CONSTRAINT fk_log_email FOREIGN KEY (email) REFERENCES users (email));Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)ALTER TABLE users DROP INDEX uq_email;ERROR 1553 (HY000): Cannot drop index 'uq_email': needed in a foreign key constraintSELECT table_name, constraint_name, referenced_column_name FROM information_schema.key_column_usage WHERE referenced_table_name = 'users';+------------+-----------------+------------------------+
| TABLE_NAME | CONSTRAINT_NAME | REFERENCED_COLUMN_NAME |
+------------+-----------------+------------------------+
| login_log | fk_log_email | email |
+------------+-----------------+------------------------+
1 row in set (0.00 sec)ALTER TABLE login_log DROP FOREIGN KEY fk_log_email;Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0Find who references the table with information_schema.key_column_usage where referenced_table_name = 'users': login_log.fk_log_email. Drop that foreign key first, then uq_email can be dropped.
ALTER TABLE users DROP INDEX uq_email;Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0FAQ
What does Cannot drop index needed in a foreign key constraint mean?
A foreign key uses that index. Drop the foreign key first, or create another index on the same leading columns so the foreign key can use it.
How do I drop a foreign key index in MySQL?
Run ALTER TABLE t DROP FOREIGN KEY fk_name; first, then ALTER TABLE t DROP INDEX idx_name;.
How do I replace an index used by a foreign key without dropping the FK?
Create the new index first (with the FK column as the first column), then drop the old one.
How do I find which foreign key uses an index?
Query information_schema.key_column_usage for the table, or for the parent side filter on referenced_table_name.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test, each with full rights on a database of the same name (its default database); root is the administrator. MySQL 8.4.13