Skip to content

Instantly share code, notes, and snippets.

@Shaz3e
Last active November 2, 2023 13:19
Show Gist options
  • Save Shaz3e/68071bcce399e6005a9bffaa1bf61718 to your computer and use it in GitHub Desktop.
Save Shaz3e/68071bcce399e6005a9bffaa1bf61718 to your computer and use it in GitHub Desktop.
How to Remove Foreign Key and Index from Database

instructions

  • Go to PHPMyAdmin
  • Select Database
  • Click Query Tab

Insert the following commands one by one make sure to change table_name with actual table name and column name with actual column name

First you need to remove foreign key from table.column

ALTER TABLE `table_name`
DROP FOREIGN KEY `table_name_column_name_foreign`;

Than remove index from table.column

ALTER TABLE `table_name`
DROP INDEX `table_name_column_name_foreign`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment