To see all the tables in the database you can use the following statement :
show tables;
To list/show the tables in a MySQL database:
- Log into your database using the MySQL client,
- Issue the use command to connect to your desired database, and then
- Use the MySQL show tables command, like this: “show tables;”
MySQL show tables – A complete example :
First, connect to your MySQL database using your MySQL client from your operating system command line:
1 2 3 4 5 6 7 8 9 |
[user@localhost $] mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 36 Server version: 5.5.46-0ubuntu0.12.04.2 (Ubuntu)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> |
Next, after you’re logged into your MySQL database, tell MySQL which database you want to use:
1 2 3 4 |
mysql> use TutorialspaceDB ; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> |
And now issue the MySQL show tables command to list the tables in the current database:
1 2 3 4 5 6 7 8 9 |
mysql> show tables; +-----------------------+ | TutorialspaceTable | +-----------------------+ | Table1 | | Table1 | | Table1 | +-----------------------+ 3 rows in set (0.00 sec) |
Conclusion
IIn this post, i have explained How to List All tables in a MySQL database.
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂