Omega002
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_leng th)/1024/1 024 AS total_mb,
SUM(data_length)/1024/1024 AS data_mb,
SUM(index_length)/1024/102 4 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_leng th)/1024/1 024 AS total_mb
FROM information_schema.tables
GROUP BY table_schema
ORDER BY 2 DESC
LIMIT 1;
Please HELP!
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_leng
SUM(data_length)/1024/1024
SUM(index_length)/1024/102
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_leng
FROM information_schema.tables
GROUP BY table_schema
ORDER BY 2 DESC
LIMIT 1;
Please HELP!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you attach the error message you gain while executing this SQL in MySQL 4.1?
ASKER
The information schema table does not exist in MySQL 4.1.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER