用SQL命令檢視Mysql資料庫大小

2022-05-22 07:24:08 字數 555 閱讀 4144

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

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用SQL命令檢視Mysql資料庫大小

要想知道每個資料庫的大小的話,步驟如下 1 進入information schema 資料庫 存放了其他的資料庫的資訊 use information schema 2 查詢所有資料的大小 select concat round sum data length 1024 1024 2 mb as d...

用SQL命令檢視Mysql資料庫大小

要想知道每個資料庫的大小的話,步驟如下 1 進入information schema 資料庫 存放了其他的資料庫的資訊 use information schema 2 查詢所有資料的大小 select concat round sum data length 1024 1024 2 mb as d...

用SQL命令檢視Mysql資料庫大小

要想知道每個資料庫的大小的話,步驟如下 1 進入information schema 資料庫 存放了其他的資料庫的資訊 use information schema 2 查詢所有資料的大小 select concat round sum data length 1024 1024 2 mb as d...