用SQL命令查看Mysql數據庫大小

要想知道每一個數據庫的大小的話,步驟以下:數據庫

一、進入information_schema 數據庫(存放了其餘的數據庫的信息)post

use information_schema;

二、查詢全部數據的大小:code

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

三、查看指定數據庫的大小:orm

好比查看數據庫home的大小blog

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

四、查看指定數據庫的某個表的大小io

好比查看數據庫home中 members 表的大小table

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home' and table_name='members';
相關文章
相關標籤/搜索