查看mysql日誌文件大小和數據庫大小

查看數據庫日誌文件的大小mysql

show binary logs;sql

刪除bin-log(刪除mysql-bin.00000*小於mysql-bin.000003全部日誌)數據庫

purge binary logs to 'mysql-bin.000003';日誌


要想知道每一個數據庫的大小的話,步驟以下:orm

一、進入information_schema 數據庫(存放了其餘的數據庫的信息)io

use information_schema;table


二、查詢全部數據的大小:form

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;  
SELECT SUM(DATA_LENGTH)+SUM(INDEX_LENGTH) FROM information_schema.tablesselect

 

三、查看指定數據庫的大小:數據

好比查看數據庫radius的大小

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='radius';
 

四、查看指定數據庫的某個表的大小

好比查看數據庫radius中 rm_users 表的大小

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='radius' and table_name='rm_users';

相關文章
相關標籤/搜索