Show Tables SQL Command

How to list the table in your MySQL database

Businessman working on computer
Hybrid Images/Cultura/Getty Images

MySQL is open source relational database management software that website owners and others use to organize and retrieve data. A database consists of one or more tables with several columns, each containing information. If you run a website and use MySQL, you may need to view a complete list of tables in the database.

Using the MySQL Command Line Client

Connect with your web server and log in to your database.

Pick the database you want to use if you have more than one. In this example, the database is named "Pizza Store."

  $ mysql -u root -p

  mysql> USE pizza_store;

Now use the MySQL SHOW TABLES command to list the tables in the chosen database.

  mysql> SHOW TABLES;

This command returns a list of all the tables in the chosen database.

MySQL Tips 

  • Every MySQL command ends with a semicolon. If it is missing, the command does not execute.
  • The MySQL command line is not case sensitive, but commands are usually written in uppercase, while tables, databases, usernames and text are usually in lowercase to make them easier to identify.

When to Use a Database?

A database is a structured collection of data. Here are a few examples of when a database might come in handy when you are working with your website:

  • If you have an online store, a database stores the products you sell, the customer information and the orders.
  • A database for an online forum stores member names, forums, topics and posts.
  • A blog uses a database to store blog posts, categories, comments and tags.

Why Use MySQL?

  • Because it is open source software, it is free to everybody
  • MySQL can be installed on lots of different platforms
  • MySQL is usually included in most web hosting packages
  • It's easy to use
  • It works well with PHP to add functionality to your website