Mysql drop (remove) unique key
To remove a mysql unique key, aka index it first needs to be checked.
How to check mysql unique indexes existing on a table:Code:
mysql> SHOW INDEXES FROM my_table;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| my_table | 0 | id | 1 | id | A | 0 | NULL | NULL | | BTREE | | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
Drop unique key (DROP INDEX `id` on my_table;):Code:
mysql> DROP INDEX `id` on my_table;
Query OK, 0 rows affected (0.29 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> SHOW INDEXES FROM my_table;
Empty set (0.00 sec)
Please make sure you have backups before running any drop/truncate commands in mysql.