mysqladmin extended-status|grep -v "0 "
mysql -t -u root << EOF
SELECT a.schema_name db_name,
IFNULL(ROUND((SUM(b.data_length)+SUM(b.index_length))/1024/1024,2),0.00)
total_size_mb,
IFNULL(ROUND(((SUM(b.data_length)+SUM(b.index_length))-
SUM(b.data_free))/1024/1024,2),0.00) data_used_mb,
IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00) data_free_mb,
IFNULL(ROUND((((SUM(b.data_length)+SUM(b.index_length))-SUM(b.data_free))/
((SUM(b.data_length)+SUM(b.index_length)))*100),2),0) pct_used,
COUNT(table_name) tables
FROM information_schema.schemata a
LEFT JOIN information_schema.tables b ON a.schema_name = b.table_schema
WHERE b.data_length>10485760 and a.schema_name != 'information_schema'
GROUP BY a.schema_name
ORDER BY 1;
exit
EOF
mysql -t -u root << EOF
select table_schema,table_name,table_rows from information_schema.tables where table_rows>2000 order by table_rows desc;
exit
EOF
mysql -t -u root << EOF
SELECT a.schema_name db_name,
IFNULL(ROUND((SUM(b.data_length)+SUM(b.index_length))/1024/1024,2),0.00)
total_size_mb,
IFNULL(ROUND(((SUM(b.data_length)+SUM(b.index_length))-
SUM(b.data_free))/1024/1024,2),0.00) data_used_mb,
IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00) data_free_mb,
IFNULL(ROUND((((SUM(b.data_length)+SUM(b.index_length))-SUM(b.data_free))/
((SUM(b.data_length)+SUM(b.index_length)))*100),2),0) pct_used,
COUNT(table_name) tables
FROM information_schema.schemata a
LEFT JOIN information_schema.tables b ON a.schema_name = b.table_schema
WHERE b.data_length>10485760 and a.schema_name != 'information_schema'
GROUP BY a.schema_name
ORDER BY 1;
exit
EOF
mysql -t -u root << EOF
select table_schema,table_name,table_rows from information_schema.tables where table_rows>2000 order by table_rows desc;
exit
EOF