When working with MySQL databases, you usually have to list the database tables or perform some commands to retrieve the common information of DB as well.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related MySQL databases queries.
In this context, we shall look into how to list tables in the MySQL database by using the command line.
To begin, you have to connect to the MySQL server by running the following command:
$ mysql -u user -p
Let's take a quick look at an example below with user "linuxAPT":
$ mysql -u linuxAPT -p
In the MySQL shell, let's choose the database we will work on:
mysql> USE database-name;
In order to list all of the tables in the current chosen database, run the following command:
mysql> SHOW tables;
If you want to list the tables with their type, run:
mysql> SHOW FULL tables;
This article covers how to get information of the tables in the MySQL database. The following illustrates the syntax of the MySQL SHOW TABLES command:
SHOW TABLES;