[KLUG Members] Fw: [linux-Ahmedabad-users] How to get size of Database in MySQL

Adam Williams members@kalamazoolinux.org
Tue, 10 Feb 2004 14:22:30 -0500 (EST)


>If you lack php/phpmyadmin you could just walk the database by hand.
>Go to each database,
> go to each table in the database,
>  write down the type/length of each field,
>  -the MySQL manual has tables of types/sizes
>  -at and around http://www.mysql.com/doc/en/Numeric_types.html
>  -short version [in bytes]:
>  - int:4
>  - 4 year time stamp: 8
>  - char: as defined in the table and add one byte
>  - varchar: /up to/ as defined in the table and add one byte
>  add up the lengths of each field and multiply by the number
>  -of records in the table
>This should give you a somewhat accurate count.

Except it won't include indexes, which can be a significant portion of a 
database.

You could -
$ cd /var/lib/mysql
$ du -ks *