How to drop unique in MySQL?

前端 未结 10 780
[愿得一人]
[愿得一人] 2020-12-07 11:20
Create Table: CREATE TABLE `fuinfo` (
  `fid` int(10) unsigned NOT NULL,
  `name` varchar(40) NOT NULL,
  `email` varchar(128) NOT NULL,
  UNIQUE KEY `email` (`email         


        
10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 11:31

    mysql> DROP INDEX email ON fuinfo;

    where email is the unique key (rather than the column name). You find the name of the unique key by

    mysql> SHOW CREATE TABLE fuinfo;
    

    here you see the name of the unique key, which could be email_2, for example. So...

    mysql> DROP INDEX email_2 ON fuinfo;
    
    mysql> DESCRIBE fuinfo;
    

    This should show that the index is removed

提交回复
热议问题