Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted
mysql> select * from information_schema.tables where table_name='foo'\G
share|improve this answer

Following query will provides the DB name.

select TABLE_SCHEMA from TABLES WHERE  TABLE_NAME like '%yourtablename%'\G;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.