Mysql check database size
<?
mysql_connect("localhost", "root", "xxxx");
mysql_select_db("reporting");
$result = mysql_query("show table status");
$size = 0;
$out = "";
while($row = mysql_fetch_array($result)) {
$size += $row["Data_length"];
$out .= $row["Name"] .": ".
round(($row["Data_length"]/1024)/1024, 2) ."MB\n";
}
$size = round(($size/1024)/1024, 1);
echo $out ."<br>\n";
echo "Total MySQL db size in MB: $size";
?>
There are no comments on this page. [Add comment]