Determining if MySQL table index exists before creating

前端 未结 7 1773
一向
一向 2021-02-04 14:35

Our system\'s automated database migration process involves running .sql scripts containing new table definitions and their accompanying indexes.

I require the ability t

相关标签:
7条回答
  • 2021-02-04 15:31

    Use SHOW INDEX FROM mytable FROM mydb; and check if the index is present - each of the returned rows represents one part of an index; the column that would probably interest you most is Key_name, as it contains the name of the index. Documentation here.

    0 讨论(0)
提交回复
热议问题