Warren Windvogel wrote:
> Hi,
>
> Can anyone tell me how to check the total number of records in a
> database in MySQL version 4.0
> Googling doesn't seem to help and all previous posts assume version 5.*
>
> Regards
> Warren
>
for table you can use:
SELECT COUNT(*) from the_table_name;
in whole database you can iterate trough all tables, for that create
simple bash script. For example:

#!/bin/bash

tables=`mysql -uUser -pPass -hHost database_name --skip-column-names -e
"SHOW TABLES"`
total=0
for table in $tables
do
    rows=`mysql -uUser -pPass -hHost database_name --skip-column-names
-e "SELECT COUNT(*) from $table"`
    total=$(($total+rows))
done
echo $total

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to