Link to home
Start Free TrialLog in
Avatar of Omega002
Omega002Flag for Afghanistan

asked on

List Database Sizes For All MySQL 4.1 databases

Greetings,

Does anyone have a script that will list database sizes for all MySQL 4.1 databases? I have a script that will do it for MySQL 5.1 but that script does not work for MySQL 4.1.  Here's the script that works from me in MySQL 5.1:

SELECT NOW(), VERSION();

SELECT table_schema,

 SUM(data_length+index_length)/1024/1024 AS total_mb,

 SUM(data_length)/1024/1024 AS data_mb,

 SUM(index_length)/1024/1024 AS index_mb,

 COUNT(*) AS tables,

 CURDATE() AS today

FROM information_schema.tables

GROUP BY table_schema

ORDER BY 2 DESC;

# Set a session variable for the largest schema for later use

SELECT @schema := table_schema,

 SUM(data_length+index_length)/1024/1024 AS total_mb

FROM information_schema.tables

GROUP BY table_schema

ORDER BY 2 DESC

LIMIT 1;

Please HELP!

ASKER CERTIFIED SOLUTION
Avatar of Cong Minh Vo
Cong Minh Vo
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Omega002

ASKER

This is pretty much the same script and it only works in MySQL 5.0 version not MySQL 4.1. I am looking for a script that will list database sizes for MySQL 4.1.
Can you attach the error message you gain while executing this SQL in MySQL 4.1?
The information schema table does not exist in MySQL 4.1.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial