码迷,mamicode.com
首页 > 数据库 > 详细

mysql查询数据库大小

时间:2019-03-12 12:02:52      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:ble   base   inf   schema   adb   sch   use   length   方法   

查看数据库大小的方法:
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‘;

mysql查询数据库大小

标签:ble   base   inf   schema   adb   sch   use   length   方法   

原文地址:https://blog.51cto.com/smartlieo/2361643

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!