如何查询MySQL数据库所占用的空间大小

====进入终端=====
mysql -uroot -p
show databases;
use information_schema;

====1.查看数据库总大小====
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from tables;

====2.查询某个数据库的大小====
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from tables where TABLE_SCHEMA='wordpress';

====3.查询某个数据库下某个表的大小====
select concat(round(DATA_LENGTH/1024/1024,2),'MB') as data from tables where TABLE_SCHEMA='wordpress' and TABLE_NAME='wp_options';
分类:   数据库  / 
标签:   mysql
 /  浏览量:  162
2019-9-2 17:48 Monday