How to view indexes that I set in MySQL?

I have some indexes configured in a table entriesand I want to view / list them. Is there any way to do this?

+3
source share
4 answers
show index from entries;

more details: http://dev.mysql.com/doc/refman/5.0/en/show-index.html

Another way is to use information_schema.STATISTICS

SELECT * FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA='{$db}' AND TABLE_NAME='entries';
+7
source

In addition to ajreal answer:

SHOW INDEX FROM entries

which, in my opinion, is the correct answer here, there is another useful command that I think is worth mentioning if you do not already know it:

SHOW CREATE TABLE entries

, , . , , , . , , , .

+6

The request is as follows:

SHOW index FROM entries;

You can follow this link for more information: -

http://dev.mysql.com/doc/refman/5.0/en/show-index.html

+1
source

Source: https://habr.com/ru/post/1780765/


All Articles