I created a foreign key on a table just using this statement. When I wanted to drop it, phpMyAdmin didn't allow me to do so. Would anyone suggest a nice way of getting away with it?
ALTER TABLE `likes` ADD CONSTRAINT (fk_user_id) FOREIGN KEY REFERENCES `users` (user_id);
This line worked fine and created an index instead of creating a foreign key. And, I wanted to drop it and create a foreign key. Unfortunately, it didn't want to be dropped.
The message I got from phpMyAdmin is below:
SQL query: ALTER TABLE `likes` DROP INDEX `fk_user_id` MySQL said: Documentation #1553 - Cannot drop index 'fk_user_id': needed in a foreign key constraint