I have one table X. I need to drop all the foreign keys in the table. I don't know how to drop.Can any one please say the query.
probably, you should get the foreign keys using
SHOW CREATE TABLE <your_table>
then delete the foriegn keys one by one
ALTER TABLE <table_name> DROP FOREIGN KEY <key_name>;
Read this will help you http://bugs.mysql.com/bug.php?id=14347
http://www.w3schools.com/sql/sql_foreignkey.asp The foreign key constraint has to be dropped by constraint name and not the index name. The syntax is:
alter table test_table drop foreign key test_tableconstraint
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.