Files
Cockatrice/servatrice/scripts/linux/info_db_tablesize
woogerboy21 44025c667e Script Cleanup
Added the ability to specify custom database name.
Added the ability to specify custom table prefix.
Created sub folders for operating systems.
2015-07-14 15:05:02 -04:00

9 lines
588 B
Bash

#!/bin/bash
#USE THIS SCRIPT TO IDENTIFY THE SIZE OF YOUR TABLES IN THE DATABASE
DBNAME="servatrice" #set this to the database name used
TABLEPREFIX="cockatrice" #set this to the prefix used for the table names in the database (do not inclue the _)
SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file
mysql --defaults-file=$SQLCONFFILE -e 'SELECT table_name AS "Tables", round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "'$DBNAME'" ORDER BY (data_length + index_length) DESC;'