创建数据库
mysql> create database if not exists testdb default character set utf8 default collate utf8_general_ci;
查查数据库大小
mysql> use nformation_schema
mysql> select concat(round(sum(data_length)/(10241024),2) + round(sum(index_length)/(10241024),2),‘MB’) as B Size’ from tables wheretable_schema=’ testdb’;
查看数据所占的空间大小
mysql> use information_schema;
mysql> select concat(round(sum(data_length)/(1024*1024),2),‘MB’) as ‘DB Size’ from tables where table_schema=‘testdb’;