MySQL: How to list all available tables in the system

MySQL: How to list all available tables in the system

Because sometimes you just need to know (the available tables are out there so you can use that list in a script).

If you are running MySQL Workbench you can execute the following SQL Query and export the results to a file:

select table_name from information_schema.tables where table_name like ‘wp_%’

If you are running mysql from a command line you can leverage this to create your output file:

mysql -N information_schema -e “select table_name from tables where table_name like ‘wp_%'” > tables.txt

Then of course you could use your tables.txt file as input for another SQL query.

Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.