Answers I found on the internet were all based on the table information_schema.tables but truth is, this table contains table schemas of databases, not the database list.

What happens when you also need to include databases with no table?
Answer with this query:

SELECT SCHEMA_NAME AS 'Database', COUNT(information_schema.tables.TABLE_SCHEMA) AS 'Table Count'
FROM information_schema.SCHEMATA
LEFT JOIN information_schema.tables ON information_schema.tables.TABLE_SCHEMA = information_schema.SCHEMATA.SCHEMA_NAME
WHERE SCHEMA_NAME NOT IN ('mysql', 'information_schema', 'performance_schema', 'tmp')
| Database | Table Count |
| acme     |           8 |
| bar      |           0 |
| foo      |           2 |
3 rows in set (0.01 sec)

Hope this will be useful to somebody someday :-)

Joris Berthelot