mysql> SELECT IFNULL(db,'Total') "Database",
-> datsum / power(1024,pw) "Data Size",
-> ndxsum / power(1024,pw) "Index Size",
-> totsum / power(1024,pw) "Total"
-> FROM (SELECT db,SUM(dat) datsum,SUM(ndx) ndxsum,SUM(dat+ndx) totsum
-> FROM (SELECT table_schema db,data_length dat,index_length ndx
-> FROM information_schema.tables WHERE engine IS NOT NULL
-> AND table_schema NOT IN ('information_schema','mysql')) AA
-> GROUP BY db WITH ROLLUP) A,(SELECT 1 pw) B;
+--------------------+-------------------+------------+-------------------+