Search code examples
phpmysqlphp-5.3

How to get the space free in my Mysql database?


I have a question in my mind that is it possible to get the space available and used in a MySql Database using PHP? I have the following MySql config --

SERVER: localhost
USER : root
PASSWORD : ********

So can anyone provide me a code or suggest me a code or can even give me link to get space available and used in a MySql Database of my Localhost server.


Solution

  • Your space available in the mysql database table is based on your hard disk capacity, assuming you are not using a pre-allocated space innodb table.

    To see the space taken up by a table just cd to the mysql data directory as defined in your config file. You will see a directory for each database. Then, inside those directories you will see the files for each table and can see the space taken up by each.