统计MySQL数据库硬盘占用量大小】的更多相关文章

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size, concat(truncate(index_length/1024/1024,2),' MB') as index_size from information_schema.tables where TABLE_SCHEMA = '数据库名' order by data_length desc;…
查看某个表的磁盘占用量 select (data_length+index_length)/1024/1024 M from information_schema.tables where table_schema="db_name" and table_name='table_name'; 查看整个数据库的磁盘用量 select sum((data_length+index_length)/1024/1024) M from information_schema.tables whe…
#查看每个数据库所占磁盘大小 SELECT TABLE_SCHEMA AS "库名", , ) AS "表所占空间(MB)", , ) AS "索引所占空间(MB)", ,) AS "空间累计(MB)" FROM information_schema.`TABLES` GROUP BY `TABLE_SCHEMA`;  #查看某个数据库各表所占磁盘大小 SELECT TABLE_NAME, , ) AS "DATA_…
use information_schema; -- 查询一个数据库存储大小 select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='database nane'; 85MB -- 查询一个表存储大小 select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where…
1.查询一个表中有多少个字段: SELECT COUNT(*) FROM information_schema. COLUMNSWHERE table_schema = '数据库名'AND table_name = '表名'; 2.查询一个数据库中有多少张表: SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES   WHERE table_schema = '数据库名' GROUP BY table_schema…
多实例下: 可以通过绑定cpu,来防止多实例相互干扰. mongodb的内存也可以限制主,防止全部内存都被一个实例占据. ulimit -s 4096 && ulimit -m 31457280 && sudo -u mongodb numactl --cpunodebind=0 --localalloc /opt/soft/mongodb-2.2.0/bin/mongod --fork --master --oplogSize 10240 --port 27001 --d…
方法1.用 if 语句,如下例. 方法2.用case when then else 语句,用法如同if. mysql> select sum(if(id<500,1,0)),sum(if(id>=500 && id<1000,1,0)) from customer;   +---------------------+---------------------------------+ | sum(if(id<500,1,0)) | sum(if(id>=…
//数据库表存储大小 select table_schema,table_name,table_rows,concat(round(data_length/1024/1024/1024,2),'GB') length from tables where table_schema='ERP' order by table_rows desc; //一台服务器传输到另一台服务器 路径写法 scp /home/table_t_user.sql  root@115.29.249.149:/home //…
查看所有mysql数据库表和索引大小 mysql查看当前所有的数据库和索引大小 ,),' mb') as data_size, concat(,),'mb') as index_size from information_schema.tables group by table_schema order by data_length desc; mysql查看当前某个数据库和数据库下所有的表的大小 ,),' mb') as data_size, concat(,),' mb') as index…
vim mysql.sh #!/bin/bashDAY=`date +%Y-%m-%d` //日期以年月日显示并赋予DAY变量SIZE=`du -sh /var/lib/mysql //查看mysql的大小并且赋予变量SIZEecho "Date :$DAY" >> /tmp/mysqlbak.txt  //输出日期到mysqlbak.txt文件echo "Date Size : $SIZE" >> /tmp/mysqlbak.txt //输…