Skip to content
Log In Sign Up info@muvcloud.com

SHOW TABLES

Log in with an account that has rights on the database, for example mysql -u app_user -p app, or as an administrator with sudo mysql or sudo mariadb. Then:

USE app;
SHOW TABLES;

The result has one column, named Tables_in_app, with one row per table. Without a selected database, MySQL answers with error 1046, no database selected. To find the database names, see how to list databases in MySQL.

Without Switching Databases

SHOW TABLES FROM app;
SHOW TABLES IN app;

Both forms are the same. They leave the current database unchanged, which helps inside scripts.

Filter by Name

SHOW TABLES LIKE 'wp\_%';
SHOW TABLES FROM app LIKE 'order%';

% matches any run of characters and _ matches one. Because _ is a wildcard, write \_ to match a real underscore, as in the first line, which lists tables that start with wp_.

Tables and Views

SHOW FULL TABLES;
SHOW FULL TABLES WHERE Table_type = 'VIEW';

FULL adds a second column, Table_type, with BASE TABLE for real tables and VIEW for views. Plain SHOW TABLES lists both without telling them apart.

From the Shell

sudo mysql -e "SHOW TABLES FROM app;"
sudo mysql -N -B -e "SHOW TABLES FROM app;"
sudo mysqlshow app

The second form prints bare names, one per line, for scripts. mysqlshow lists the tables of the database you name. On MariaDB the tool is mariadb-show; on Debian 13 and Ubuntu 26.04 the old name exists only with the mariadb-client-compat package.

Query information_schema

For conditions and extra columns, ask the metadata tables directly:

SELECT table_name, table_type, engine, table_rows
FROM information_schema.tables
WHERE table_schema = 'app'
ORDER BY table_name;

Count the tables of a database:

SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'app';

table_rows is an estimate for InnoDB tables, not an exact count; use SELECT COUNT(*) FROM app.orders; when you need the real number. The same tables give sizes too, as shown in how to check MySQL database size.

Columns of a Table

DESCRIBE orders;
SHOW COLUMNS FROM orders FROM app;
SHOW INDEX FROM orders;

DESCRIBE (or DESC) and SHOW COLUMNS list each column with its type, whether it may be empty, its key, and its default. SHOW INDEX lists the indexes.

The Full Definition

SHOW CREATE TABLE orders\G

This prints the CREATE TABLE statement that would rebuild the table's structure: columns, indexes, foreign keys, engine, and character set. Ending with \G instead of a semicolon prints the result as lines rather than a wide table. SHOW CREATE VIEW does the same for a view.

When a Table Is Missing

  • Wrong database: check the current one with SELECT DATABASE();.
  • No rights: the list shows only tables your account can use; compare with SHOW GRANTS; and see how to create a MySQL user.
  • Letter case: on Linux, table names are case-sensitive by default, so Orders and orders are different tables.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations