On Mon, 19 Jul 2004 22:49:53 GMT, "Sharif T. Karim" <sharif@nyc.rr. com> wrote:
[color=blue]
>How would I get the total size of a mysql database in MB format?[/color]
Log on to the database server, find the data directory, and use "du -hs" on
the directory.
"steve" wrote:[color=blue]
> [quote:0f06a43aa 5="Sharif T. Karim"]How would I get the total[/color]
size of[color=blue]
> a mysql database in MB format?
>[/color] http://www.webmasterworld.com/forum88/2069.htm[/quote:0f06a43aa 5]
Sorry, the above URL is password protected.
Here’s how to do it from php.
do a mysql "show table status"
which produces a number of columns including "data_lengh t" and
"index_leng ht". Simply add these two number and furthere add them
for all the return records (i.e. tables), and you get the db size.
steve, being the foo steve is, wrote:[color=blue]
> "steve" wrote:[color=green]
> > [quote:0f06a43aa 5="Sharif T. Karim"]How would I get the total[/color]
> size of[color=green]
> > a mysql database in MB format?
> >[/color]
> http://www.webmasterworld.com/forum88/2069.htm[/quote:0f06a43aa 5]
>
> Sorry, the above URL is password protected.
> Here's how to do it from php.
> do a mysql "show table status"
> which produces a number of columns including "data_lengh t" and
> "index_leng ht". Simply add these two number and furthere add them
> for all the return records (i.e. tables), and you get the db size.[/color]
Would I have to do a loop to get the total? Or just those array variables
will have the total together?
--
Sharif T. Karim
....you don't know wrath yet...
"Sharif T. Karim" wrote:[color=blue]
> steve, being the foo steve is, wrote:[color=green]
> > "steve" wrote:[color=darkred]
> > > [quote:0f06a43aa 5="Sharif T. Karim"]How would I get the[/color][/color][/color]
total[color=blue][color=green]
> > size of[color=darkred]
> > > a mysql database in MB format?
> > >[/color]
> > http://www.webmasterworld.com/forum88/2069.htm[/color]
>
> Sorry, the above URL is password protected.
> Here’s how to do it from php.
> do a mysql "show table status"
> which produces a number of columns including "data_lengh t" and
> "index_leng ht". Simply add these two number and furthere add[/color]
them[color=blue]
> for all the return records (i.e. tables), and you get the db size.[/color]
Would I have to do a loop to get the total? Or just those array
variables
will have the total together?
[/quote:16866fe06 a]
Sharif, each row of the result set would have two values that you
need: the index size, and the data size. Each row pertains to a
single table.
So you have to loop thru all the returned rows, and add these numbers
up to get the total size of the database.
Here is another page, just copy the code!
Comment