Olá pessoal...
dei uma procurada e não encontrei nada mais concreto.
achei até alguma coisa pra gráficos, mas não o que preciso exatamente.
Gostaria de exibir o tamanho do meu BD MySQL.
como faço isso com PHP?
Pegar Tamanho De Um Banco Mysql
Started By Agente Linhares, 20/05/2009, 13:21
2 replies to this topic
#1
Posted 20/05/2009, 13:21
- Miguceamma likes this
> Busca On-line - A Busca que faltava na Internet! - Cadastre-se!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!
#2
Posted 20/05/2009, 13:29
[codebox]<?php
$db_server = 'localhost';
$db_user = 'user';
$db_pwd = 'senha';
$db_name = 'nome_banco';
$db_link = mysql_connect($db_server, $db_user, $db_pwd) or die();
$db = mysql_select_db($db_name, $db_link) or die();
$rows = mysql_query("SHOW TABLE STATUS");
$dbsize = 0;
while ($row = mysql_fetch_array($rows)) {
$dbsize += $row['Data_length'] + $row['Index_length'];
}
print "Tamanho: $dbsize bytes";
?>[/codebox]
não testei... mas creio que esteja correto.
$db_server = 'localhost';
$db_user = 'user';
$db_pwd = 'senha';
$db_name = 'nome_banco';
$db_link = mysql_connect($db_server, $db_user, $db_pwd) or die();
$db = mysql_select_db($db_name, $db_link) or die();
$rows = mysql_query("SHOW TABLE STATUS");
$dbsize = 0;
while ($row = mysql_fetch_array($rows)) {
$dbsize += $row['Data_length'] + $row['Index_length'];
}
print "Tamanho: $dbsize bytes";
?>[/codebox]
não testei... mas creio que esteja correto.
#3
Posted 20/05/2009, 14:36
vlw brother..
pesquisando sobre o "show table status" achei algo tb:
+ http://dev.mysql.com...ble-status.html
+ http://under-linux.o...-database-mysql
brigadão..flws
pesquisando sobre o "show table status" achei algo tb:
$result = mysql_query("SHOW TABLE STATUS"); while($array = mysql_fetch_array($result)) { $total = $array[Data_length]+$array[Index_length]; echo ' Table: '.$array[Name].'<br /> Data Size: '.$array[Data_length].'<br /> Index Size: '.$array[Index_length].'<br /> Total Size: '.$total.'<br /> Total Rows: '.$array[Rows].'<br /> Average Size Per Row: '.$array[Avg_row_length].'<br /><br />' ; }
+ http://dev.mysql.com...ble-status.html
+ http://under-linux.o...-database-mysql
brigadão..flws
Edição feita por: Agente Linhares, 20/05/2009, 17:34.
> Busca On-line - A Busca que faltava na Internet! - Cadastre-se!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)