您好,登錄后才能下訂單哦!
這篇文章給大家介紹Mysql怎樣查看數(shù)據(jù)庫(kù)大小,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
1 命令行進(jìn)入數(shù)據(jù)庫(kù)
[root@80 ~]# mysql -uroot -p Enter password:
2 查看數(shù)據(jù)庫(kù)
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+
3 查看information_schema的"TABLES"
mysql> use information_schema; | TABLES |
4 查看字段結(jié)構(gòu)
mysql> desc tables; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ | TABLE_CATALOG | varchar(512) | NO | | | | | TABLE_SCHEMA | varchar(64) | NO | | | | | TABLE_NAME | varchar(64) | NO | | | | | TABLE_TYPE | varchar(64) | NO | | | | | ENGINE | varchar(64) | YES | | NULL | | | VERSION | bigint(21) unsigned | YES | | NULL | | | ROW_FORMAT | varchar(10) | YES | | NULL | | | TABLE_ROWS | bigint(21) unsigned | YES | | NULL | | | AVG_ROW_LENGTH | bigint(21) unsigned | YES | | NULL | | | DATA_LENGTH | bigint(21) unsigned | YES | | NULL | | | MAX_DATA_LENGTH | bigint(21) unsigned | YES | | NULL | | | INDEX_LENGTH | bigint(21) unsigned | YES | | NULL | | | DATA_FREE | bigint(21) unsigned | YES | | NULL | | | AUTO_INCREMENT | bigint(21) unsigned | YES | | NULL | | | CREATE_TIME | datetime | YES | | NULL | | | UPDATE_TIME | datetime | YES | | NULL | | | CHECK_TIME | datetime | YES | | NULL | | | TABLE_COLLATION | varchar(32) | YES | | NULL | | | CHECKSUM | bigint(21) unsigned | YES | | NULL | | | CREATE_OPTIONS | varchar(255) | YES | | NULL | | | TABLE_COMMENT | varchar(2048) | NO | | | | +-----------------+---------------------+------+-----+---------+-------+
5 查看DB的數(shù)據(jù)大小
mysql> select table_schema,round(sum(DATA_LENGTH)/1024/1024,2) as table_size from tables group by table_schema; +--------------------+------------+ | table_schema | table_size | +--------------------+------------+ | bomo_backend | 0.09 | | test1 | 234.16 | | test2 | 0.17 | | information_schema | 0.00 | | mysql | 0.71 | | performance_schema | 0.00 | | test | 0.03 | +--------------------+------------+
6 查看table的數(shù)據(jù)大小
mysql> select table_schema,table_name,concat(round(data_length/1024/1024,2),'M') as table_size from tables where table_schema = 'grab'; +--------------+--------------+------------+ | table_schema | table_name | table_size | +--------------+--------------+------------+ | grab | product | 215.12M | | grab | result | 13.52M | | grab | rule | 0.02M | | grab | task | 5.52M | +--------------+--------------+------------+
關(guān)于Mysql怎樣查看數(shù)據(jù)庫(kù)大小就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。