SELECT NAME, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
The SPACE
will be 0 for the global tablespace (ibdata1) and some greater number for file-per-table tablespaces.
See http://dev.mysql.com/doc/refman/5.6/en/innodb-sys-tables-table.html
Since you are using MySQL 5.5, the above solution will not work. In MySQL 5.5, you can use this:
SELECT DISTINCT TABLE_NAME, SPACE FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU
WHERE TABLE_NAME IS NOT NULL AND TABLE_NAME NOT LIKE 'SYS%';
Again, SPACE is 0 for the global tablespace, and greater integers for file-per-table.
With the caveat that it only reports on tables that have pages in the buffer pool. If you haven't queried a table, it will have no pages in the buffer pool LRU, and the query will not report any result for that table.
The only other solution is to use ls
in the data directory. :-)