Mysql 查看各个数据库中的存储大小
有些时候遇到数据库报警,存储容量不够的时候,如何找到罪魁祸首呢,用这个 sql
查查吧
SELECT table_schema AS 'Database',
table_name AS 'Table',
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS 'Size (MB)'
FROM information_schema.TABLES
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
ORDER BY (data_length + index_length) DESC;