Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible, from the MySQL command line, to list in a single query all the indexes/constraints/FKs etc that are in the database in question?

Thanks in advance

Rich

share|improve this question

2 Answers 2

We can also refer to INFORMATION_SCHEMA.TABLE_CONSTRAINTS dictionary table providing TABLE_SCHEMA and CONSTRAINT_TYPE in where clause/

CONSTRAINT_TYPE could be 'UNIQUE'/'PRIMARY KEY'/FOREIGN KEY'

share|improve this answer

Take a look into information_schema database, maybe these tables can help you:

  • REFERENTIAL_CONSTRAINTS
  • COLUMNS table (column COLUMN_KEY)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.