List tables from all databases in MySQL

Article for: SQL Server Teradata MariaDB

The query below lists all tables in all user databases. To list tables just from current database use this query.

Query

select table_schema as database_name,
    table_name
from information_schema.tables
where table_type = 'BASE TABLE'
    and table_schema not in ('information_schema','mysql',
                             'performance_schema','sys')
order by database_name, table_name;

Columns

  • table_schema - database (schema) name
  • table_name - table name

Rows

  • One row: represents one table in a database (schema)
  • Scope of rows: all tables in all databases (schemas)
  • Ordered by: table name

Sample results

You could also get this

Get this interactive HTML data dictionary in minutes with Dataedo.

See live HTML data dictionary sample

Try for free

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.