Mungkin maksud Anda "Bagaimana cara membuat ulang indeks pengembangan saya di basis data langsung (yang sudah ada)"?
Jika demikian, saya pikir perintah SQL yang Anda cari adalah;
TAMPILKAN BUAT TABEL {tablename};
ALTER TABLE ADD INDEX {index_name} (col1, col2)
ALTER TABLE DROP INDEX {index_name}
Anda dapat menyalin baris "KEY" dan "CONSTRAINT" dari output "SHOW CREATE TABLE" dan meletakkannya kembali di "ALTER TABLE ADD INDEX".
dev mysql> SHOW CREATE TABLE city;
CREATE TABLE `city` (
`id` smallint(4) unsigned NOT NULL auto_increment,
`city` varchar(50) character set utf8 collate utf8_bin NOT NULL default '',
`region_id` smallint(4) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `region_idx` (region_id),
CONSTRAINT `city_ibfk_1` FOREIGN KEY (`region_id`) REFERENCES `region` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB;
live mysql> SHOW CREATE TABLE city;
CREATE TABLE `city` (
`id` smallint(4) unsigned NOT NULL auto_increment,
`city` varchar(50) character set utf8 collate utf8_bin NOT NULL default '',
`region_id` smallint(4) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
live mysql> ALTER TABLE `city` ADD KEY `region_idx` (region_id);
live mysql> ALTER TABLE `city` ADD CONSTRAINT `city_ibfk_1` FOREIGN KEY (`region_id`) REFERENCES `region` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT;
Semoga ini bisa membantu!