Drop a Unique Constraint on MySQL Table

How to drop a unique constraint on a database table in MySQL

I have a table that was automatically created by Django during the syncdb process and now I want to alter that table to remove a unique constraint on one of the columns.  To do so, you use the alter table command and the drop index option, but you will need the name of the index key.  You can retrieve the key by issuing the following command:

SHOW CREATE TABLE  mysql_table_name;

It shows the entire SQL code used to create the table.  The alter table command would look like this:

ALTER TABLE profile_bodhiprofile DROP INDEX mysql_table_name_user_id;


0 Comments, 0 trackbacks (Trackback URL)

0 responses to Drop a Unique Constraint on MySQL Table

Leave a Comment
  1. (required)
  2. Ignore this field:
  3. Don't put anything in this field:
    Don't put anything here:
  4. Leave this empty:
    (required)
  5. Your email is not publically displayed.