navicat查看mysql數據庫大小
運行以下查詢語句可查詢:

-- 查看所有數據庫大?。∕B)
SELECT
table_schema AS '數據庫名',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS '總大小(MB)'
FROM information_schema.TABLES
GROUP BY table_schema
ORDER BY SUM(data_length + index_length) DESC;
-- 查看指定數據庫(如test_db)大小
SELECT
table_schema AS '數據庫名',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS '總大小(MB)'
FROM information_schema.TABLES
WHERE table_schema = 'test_db';
-- 查看指定表(如users)大小
SELECT
table_name AS '表名',
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS '大小(MB)'
FROM information_schema.TABLES
WHERE table_schema = 'test_db' AND table_name = 'users';
每天進步一點點

浙公網安備 33010602011771號