I would like to know how much space does my MySQL database use, in order to select a web host.
I found the command SHOW TABLE STATUS LIKE \'table_name\'
so when
If you are using MySql Workbench, its very easy to get all details of Database size, each table size, index size etc.
Select Schema Inspector option
It Shows all details of Schema size
Select Tables Tab to see size of each table.
Table size diplayed in Data Lenght column
SUM(Data_free)
may or may not be valid. It depends on the history of innodb_file_per_table
. More discussion is found here.
You can get the size of your Mysql database by running the following command in Mysql client
SELECT sum(round(((data_length + index_length) / 1024 / 1024 / 1024), 2)) as "Size in GB"
FROM information_schema.TABLES
WHERE table_schema = "<database_name>"
if you want to find it in MB do this
SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;