如何查詢mysql資料庫大小

2021-09-20 22:51:45 字數 574 閱讀 5264

要想知道每個資料庫的大小的話,步驟如下:

1、進入information_schema 資料庫(存放了其他的資料庫的資訊)

use information_schema;

2、查詢所有資料的大小:

select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables;

3、檢視指定資料庫的大小:

比如檢視資料庫home的大小

select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables where table_schema='home';

4、檢視指定資料庫的某個表的大小

比如檢視資料庫home中 members 表的大小

select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables where table_schema='home' and table_name='members';

mysql查詢資料庫的大小

mysql查詢資料庫的大小的方法 1 查詢整個mysql資料庫,整個庫的大小 單位轉換為mb。select concat round sum data length 1024 1024 2 mb as data from information schema.tables2 查詢mysql資料庫,某...

如何計算MySQL資料庫大小

據我所知,有兩種計算mysql資料庫大小的方法。總結data length index length等於表的總大小。data length 儲存實際資料。index length 儲存表索引。這是列出整個資料庫大小的sql指令碼 select table schema data base name ...

查詢MySQL資料庫所占用大小

查詢mysql資料庫裡面的所有資料庫各自占用大小 select table schema,concat truncate sum data length 1024 1024,2 mb as data size,concat truncate sum index length 1024 1024,2 ...