mysql查询库总记录数和库大小

下面是查询库数据条数

SELECT
	sum( TABLE_ROWS ) 
FROM
	`information_schema`.`tables` 
WHERE
TABLE_SCHEMA='otms'

 下面是查询库大小


select concat(round(sum(data_length/1024/1024),2),'MB') as data from `information_schema`.`tables` 
WHERE
TABLE_SCHEMA='otms'

 

你可能感兴趣的:(db,mysql,mysql,统计,库,大小,行数)