0
votes

I have the following table in mysql

CREATE TABLE `account_info` (
  `id` int(11) DEFAULT NULL,
  `accesstype` int(11) DEFAULT NULL,
  `username` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
  `pass` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
   UNIQUE KEY `id` (`id`),
   KEY `accesstype` (`accesstype`),
   CONSTRAINT `account_info_ibfk_1` FOREIGN KEY (`id`) REFERENCES `master_info` (`id`),
  CONSTRAINT `account_info_ibfk_2` FOREIGN KEY (`accesstype`) REFERENCES `access_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

now i need to drop uniqueness from id (i just need it to be not null or just an index)
how can i alter this index to be something like KEY id (id) instead of UNIQUE KEY id (id) ??

1

1 Answers

0
votes

Thanks, I got a solution for my problem, but if you have better idea, please share it with us, the solution is:

mysql> alter table account_info add index (id);
mysql> drop index id on account_info;