Is there any command that I can locate a certain table from all databases? Since I forgot where the table is. Thanks.
Asked
Active
Viewed 2.7k times
23
-
"In all databases" – DimiDak Feb 15 '19 at 08:56
1 Answers
45
Use the MySQL specific:
SHOW TABLES
...or use the ANSI standard, INFORMATION_SCHEMA.TABLES:
SELECT table_name,
table_schema AS dbname
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name='searched table name'

Juan Antonio Tubío
- 1,172
- 14
- 28

OMG Ponies
- 325,700
- 82
- 523
- 502
-
But in this way, I still don't know which database that table belongs to. – Stan Sep 21 '10 at 01:55
-
@Stan: I updated the INFORMATION_SCHEMA query to exist the database the table exists in. – OMG Ponies Sep 21 '10 at 01:59
-
5
-
1So if she knew what she wants then she could use the full query as :- SELECT table_name, table_schema AS dbname FROM INFORMATION_SCHEMA.TABLES where table_name='her_table_name' – John Doe Dec 25 '16 at 19:13