<?php
$sql = new mysqli('localhost', 'user', 'pass', 'dbname') or die('MySQLi ERROR');
$q = $sql->query('SHOW TABLE STATUS');
while($row = $q->fetch_assoc())
{
$dbsize+=$row['Data_length']+$row['Index_length'];
}
echo $dbsize.' байт';
?>