MySQL 8.4 · Inspecting the database
Check database sizes
Add up data and index sizes for each database, in MB.
SELECT table_schema, ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS size_mb FROM information_schema.tables GROUP BY table_schema;
Official MySQL 8.4 documentation