SELECT COUNT(*) FROM information_schema.SCHEMATA;
(runs as user in question)
SELECT count(*) FROM ( SELECT DISTINCT TABLE_SCHEMA FROM information_schema.SCHEMA_PRIVILEGES WHERE GRANTEE LIKE("'USERNAME'%") GROUP BY TABLE_SCHEMA ) AS baseview;
(Run as root)
Warning. In MySQL, there is no such thing as an βOwnerβ for a database; in the above queries, information about the databases to which the user has access will be displayed.
source share