MySQL从表中删除所有索引 [英] MySQL dropping all indexes from table
问题描述
我有一个MySQL数据库,它运行了一段时间,并对其进行了很多更改。最近我查看了它,我注意到在某些情况下我在同一个字段上加倍了索引。有些索引丢失了,一般来说所有索引都有很多混乱。
I have a MySQL database that runs for some time now with many changes on it. Lately I looked over it and I noticed that in some cases I have doubled the index on the same field. Some Indexes are missing, and in general there is a huge mess in all the indexes.
我想从表中删除所有索引。稍后我有一个准备好的脚本,它将运行 ALTER TABLE
并添加相关索引。
I wants to drop all indexes from a table. Later on I have a prepared script that will run ALTER TABLE
and add the relevant indexes.
有没有办法从表中删除所有索引?
Is there a way to drop all indexes from a table?
推荐答案
如果你有phpmyadmin或任何类似工具,你可以很容易地用图形方式完成。
If you have phpmyadmin or any similar tool you can do that very easily graphically.
或者为每个索引做类似的事情
Or for every index do something like
ALTER TABLE `table` DROP INDEX `NameIndex`
您可以使用
SHOW INDEX FROM `table`
这篇关于MySQL从表中删除所有索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!