How to drop a unique key constraint in mysql ?
If there are no foreign key constraint defined in your table, then dropping unique key is straight forward
If there are no foreign key constraint defined in your table, then dropping unique key is straight forward
alter table table_name drop index index_name;
But if there are foreign key constraint defined in your table, then to drop it, we have to drop the foreign key constraint first, then drop the unique key constraint.
Usually we get the below error, If we try to drop unique key constraint without dropping foreign key constraint
ERROR 1025 (HY000): Error on rename of './tablename/#sql-14ae_81' to
'./tablename/columnname' (errno: 150)
So, drop your foreign keys first, then drop unique keys
No comments:
Post a Comment