SHOW TABLE STATUS
It shows you information about tables in a database. Among the areas that shows you there is one that is' Data_length ' , well, that's what took the data from each table.
What happens is that in addition to the data, can also represent what a lot of space allocated for each index. And this is indicated in the ' Index_length '
To obtain the total value of the database, it occurs to me to use , eg PHP to retrieve all the values and add them later.
It would be something like:
PHP Code :
mysql_connect ( data link) or die ( mysql_error ()) ;
mysql_select_db (" dbname " ) or die (mysql_error ()) ;
$ SQL = " SHOW TABLE STATUS " ;
$ Result = mysql_query ($ sql ) or die (mysql_error ()) ;
$ Total = 0;
while ( $ table = mysql_fetch_assoc ($ result))
$ Total + = ( $ table [' Data_length '] + $ table [ ' Index_length ']) ;
echo $ total;
That is, the variable $ total as we took the database " dbname "(in bytes).
To show that value in KB, is easy ...
PHP Code :
$ total_temp = $ total / 1024;
$ total_kb = number_format ($ total_temp , 0, ",", ".")+1;
/ / later ...
echo $ total_kb ;