2006년 10월 12일 목요일

mysql 사용량 알아보는 방법

show table status;

A quick script to show you how much disk space all your tables in a
database are using:

<?

  mysql_connect("db.modwest.com", "username", "password");
  mysql_select_db("yourdb");

  $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) ."<br>\n";
  }

  $size = round(($size/1024)/1024, 1);

  echo $out ."<br>\n";
  echo "Total MySQL db size: $size";
?>


출처 : http://blog.naver.com/dmsrud78/11691155


댓글 없음:

댓글 쓰기