How do I query which database has a table named aaa?
There're too many databases,
开发者_开发百科how can I query which database has a table named aaa
to narrow the range to search for?
You should look at the INFORMATION_SCHEMA
database for "meta" information such as which databases contain which schemata. For example, to find a list of databases that contain tables with the name aaa
, run this query:
SELECT schema_name FROM INFORMATION_SCHEMA.TABLES WHERE table_name = "aaa"
For more information on the INFORMATION_SCHEMA
, see the MySQL docs.
精彩评论