Get list of tables in MySQL database


You want to know what tables you have in your database? Easy!


The following query will returns a list of all tables

SELECT * FROM information_schema.tables

Please note that this isn't just for the currently active database, it's for all the databases you have. If you just want to see the tables in the current database, you can use the following query

SELECT * FROM information_schema.tables WHERE table_schema = database()

The function database() returns the currently selected database. You can of course also use a string to specify the database you want to use.


Please sign-in to post a comment