查看数据库大小的方法:
MariaDB [mysql]> show databases;
MariaDB [MysqL]> use information_schema;
查询所有数据库大小:
MariaDB [MysqL]> select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES;
查询制定的数据库大小:
MariaDB [MysqL]> select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='VIEWS';
可以看到,查询数据库大小只需要制定数据库的名称即可,如果需要查询数据库内制定表的大小,在最后添加条件即可:
MariaDB [MysqL]> select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='VIEWS' and table_name='name';