I have a mysql database. For which I need to retrieve only the indexes present in my entire database, Is there any way I could get it? OR get a
CREATE
indexes script which will help me do so.
I just don't want to SELECT them, rather I would like to get a script which when executed on similar database - the indexes will be added
Asked
Active
Viewed 572 times
0

gauri
- 121
- 1
- 3
- 14
-
https://stackoverflow.com/questions/5213339/how-to-see-indexes-for-a-database-or-table-in-mysql ? – vectorialpx May 21 '19 at 12:19
-
You can use the query from the below post. https://stackoverflow.com/a/5213364/10342514 – James May 21 '19 at 12:20
-
I just don't want to `SELECT` them, rather I would like to get a script which when executed on similar database - the indexes will be added – gauri May 21 '19 at 12:22
-
3Possible duplicate of [How to see indexes for a database or table in MySQL?](https://stackoverflow.com/questions/5213339/how-to-see-indexes-for-a-database-or-table-in-mysql) – Lightness Races in Orbit May 21 '19 at 12:24
-
You probably need a stored procedure to run through the output of `SHOW INDEX` from each table and build a dynamic SQL query to recreate them all. – Nick May 21 '19 at 12:29