Find a table by name in MySQL database

The queries below find tables with a specific name in a database (schema).

Query

select table_schema as database_name,
    table_name
from information_schema.tables
where table_type = 'BASE TABLE'
    and table_name = 'your table name'
order by table_schema,
    table_name;

Columns

  • database_name - name of the database (schema) where the table was found
  • table_name - name of table (redundant as it should be exactly the same as provided)

Rows

  • One row: represents a table
  • Scope of rows: all tables found
  • Ordered by: database (schema) name

Notes

  1. There might be more than one table because different databases (schemas) could contain tables with the same names

Sample results