When mysql modifies an index, the foreign key constraint causes a strange problem. In mysql5.5 of Windows, I want to modify the index of a table, run www.2cto.com [SQL] ALTER TABLE practice_log DROP INDEX ix_practice_log_userid; ALTER TABLE practice_log ADD INDEX partition (userid, practicetime); but the error message is unable drop index... : Needed in a foreign key constraint. Therefore, the foreign key constraint check is forcibly disabled: [SQL] SET FOREIGN_KEY_CHECKS = 0; ALTER TABLE practice_log DROP INDEX ix_practice_log_userid; alter table practice_log add index ix_practice_log_userid (userid, practicetime) SET FOREIGN_KEY_CHECKS = 1; INDEX modification successful. Www.2cto.com, but the problem is ..... After the database is restarted, The practice_log table is missing! When you delete the practice_log table, the following error occurs: The table does not exist; when you create a table, the following error occurs: The table already exists! This should be a mysql bug. Solution: Do not use SET FOREIGN_KEY_CHECKS = 0. You must delete the foreign key constraint and modify the index. In addition, constraints affect performance and should not be used whenever possible.