0

How would I find out which Database a particular table is present in MySql ?

Mysql version is 
+----------------------+
| version()            |
+----------------------+
| 5.1.35-community-log | 
+----------------------+

As I am having around 25 DB on an instance, I just want to find which database a particular table is present?

Ahn
  • 181
  • 3
  • 5
  • 13

2 Answers2

3
mysql> select * from information_schema.tables where table_name='foo'\G
quanta
  • 51,413
  • 19
  • 159
  • 217
0

Following query will provides the DB name.

select TABLE_SCHEMA from TABLES WHERE  TABLE_NAME like '%yourtablename%'\G;
Ahn
  • 181
  • 3
  • 5
  • 13