Announcement

Announcement Module
Collapse
No announcement yet.

Check MySQL Database Tables size via SSH or MySQL Query

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check MySQL Database Tables size via SSH or MySQL Query

    To quickly check your MySQL Database Tables Size you can follow simple method via SSH commands.

    1. Log in to your server with SSH.

    2. After logging in successfully, type the following command to access MySQL (replace username with your MySQL username, usually root):

    Code:
    mysql -u username -p
    3. After hitting Enter you'll get Password prompt, type in your password. On correct password, the mysql> prompt will appears.

    4. Now, to check sizes of all tables in your MySQL database, in the mysql> prompt type the following command:

    Code:
    SELECT table_name AS "Table",
    ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
    FROM information_schema.TABLES
    WHERE table_schema = "database_name"
    ORDER BY (data_length + index_length) DESC;
    You can also run above commands in MySQL Query via clients like PhpMyAdmin, etc.
Working...
X