查看mysql數(shù)據(jù)庫(kù)大小的四種辦法,分別有以下四種:

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了凌海免費(fèi)建站歡迎大家使用!
第一種:進(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)期不再使用。
您好,很高興為您解答。
第一種:進(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';
如若滿意,請(qǐng)點(diǎn)擊右側(cè)【采納答案】,如若還有問題,請(qǐng)點(diǎn)擊【追問】
希望我的回答對(duì)您有所幫助,望采納!
~ O(∩_∩)O~
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)站找的,都是正解
標(biāo)題名稱:怎么看mysql多大 如何看mysql
轉(zhuǎn)載來(lái)源:http://chinadenli.net/article42/hpjphc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、用戶體驗(yàn)、網(wǎng)站排名、動(dòng)態(tài)網(wǎng)站、電子商務(wù)、軟件開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)