Mysql Show Tables TutoriallIn order to list all the tables in the mysql database the following need to be done.


  •     Connect to the database
  •     Use the database
  •     Execute show tables; sql command

MySQL show tables

First, connect to your MySQL database using your MySQL client from the command line as:

$> mysql -u root -p

Next, after you're logged into your MySQL database, tell MySQL which database you want to use:

mysql> use databasename;

And now issue the MySQL show tables command to list the tables in the current database:

mysql> show tables;

Below is the actual output, here the user used is admin instead of root and the database name is apps_dbase.

-sh-3.1$ mysql -u admin -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 316465 to server version: 5.0.27

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> use apps_dbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
| Tables_in_apps_dbase      |
| users                              |
| wiimania_app_stats         |
| wiimania_photo_list         |
| wiimania_top_app_stats   |
| wiimania_user_list           |
| wiimania_video_list          |
30 rows in set (0.00 sec)