重慶分公司,新征程啟航
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
1、進(jìn)入information_schema 數(shù)據(jù)庫(kù)(存放了其他的數(shù)據(jù)庫(kù)的信息)
成都網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、成都網(wǎng)站建設(shè)公司、微信開發(fā)、小程序開發(fā)、集團(tuán)成都定制網(wǎng)頁(yè)設(shè)計(jì)等服務(wù)項(xiàng)目。核心團(tuán)隊(duì)均擁有互聯(lián)網(wǎng)行業(yè)多年經(jīng)驗(yàn),服務(wù)眾多知名企業(yè)客戶;涵蓋的客戶類型包括:成都除甲醛等眾多領(lǐng)域,積累了大量豐富的經(jīng)驗(yàn),同時(shí)也獲得了客戶的一致表?yè)P(yáng)!
use information_schema;
2、查詢所有數(shù)據(jù)的大?。?/p>
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;
3、查看指定數(shù)據(jù)庫(kù)的大小:
比如查看數(shù)據(jù)庫(kù)home的大小
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home';
4、查看指定數(shù)據(jù)庫(kù)的某個(gè)表的大小
比如查看數(shù)據(jù)庫(kù)home中 members 表的大小
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home' and table_name='members';
1、進(jìn)去指定schema
數(shù)據(jù)庫(kù)(存放了其他的數(shù)據(jù)庫(kù)的信息)
use
information_schema
2、查詢所有數(shù)據(jù)的大小
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
3、查看指定數(shù)據(jù)庫(kù)的大小
比如說(shuō)
數(shù)據(jù)庫(kù)apoyl
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl';
4、查看指定數(shù)據(jù)庫(kù)的表的大小
比如說(shuō)
數(shù)據(jù)庫(kù)apoyl
中apoyl_test表
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl'
and
table_name='apoyl_test';
整完了,有興趣的可以試哈哦!挺使用哈
查看mysql數(shù)據(jù)庫(kù)大小的四種辦法,分別有以下四種:
第一種:進(jìn)去指定schema 數(shù)據(jù)庫(kù)(存放了其他的數(shù)據(jù)庫(kù)的信息)
use information_schema
第二種:查詢所有數(shù)據(jù)的大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES()
第三種:查看指定數(shù)據(jù)庫(kù)的大小,比如說(shuō):數(shù)據(jù)庫(kù)apoyl
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='apoyl';
第四種:查看指定數(shù)據(jù)庫(kù)的表的大小,比如說(shuō):數(shù)據(jù)庫(kù)apoyl 中apoyl_test表
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='apoyl' and table_name='apoyl_test';
1、查詢整個(gè)mysql數(shù)據(jù)庫(kù),整個(gè)庫(kù)的大??;單位轉(zhuǎn)換為MB。
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data? from information_schema.TABLES
2、查詢mysql數(shù)據(jù)庫(kù),某個(gè)庫(kù)的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
3、查看庫(kù)中某個(gè)表的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
and table_name = 'test_a';
4、查看mysql庫(kù)中,test開頭的表,所有存儲(chǔ)大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
and table_name like 'test%';
1.查看mysql數(shù)據(jù)庫(kù)大小
SELECT
sum(DATA_LENGTH)+sum(INDEX_LENGTH)
FROM
information_schema.TABLES
where
TABLE_SCHEMA='數(shù)據(jù)庫(kù)名';
得到的結(jié)果是以字節(jié)為單位,除1024為K,除1048576(=1024*1024)為M。
2.查看表的最后mysql修改時(shí)間
select
TABLE_NAME,UPDATE_TIME
from
INFORMATION_SCHEMA.tables
where
TABLE_SCHEMA='數(shù)據(jù)庫(kù)名';
可以通過(guò)查看數(shù)據(jù)庫(kù)中表的mysql修改時(shí)間,來(lái)確定mysql數(shù)據(jù)庫(kù)是否已經(jīng)長(zhǎng)期不再使用。
1、進(jìn)去指定schema 數(shù)據(jù)庫(kù)(存放了其他的數(shù)據(jù)庫(kù)的信息)\x0d\x0ause information_schema\x0d\x0a2、查詢所有數(shù)據(jù)的大小\x0d\x0aselect concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES\x0d\x0a3、查看指定數(shù)據(jù)庫(kù)的大小\x0d\x0a比如說(shuō) 數(shù)據(jù)庫(kù)apoyl\x0d\x0aselect concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='apoyl';\x0d\x0a4、查看指定數(shù)據(jù)庫(kù)的表的大小\x0d\x0a比如說(shuō) 數(shù)據(jù)庫(kù)apoyl 中apoyl_test表\x0d\x0aselect concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='apoyl' and table_name='apoyl_test';\x0d\x0a整完了,有興趣的可以試哈哦!挺使用哈\x0d\x0a網(wǎng)站找的,都是正解