Check the size of MariaDB Schemas
Check the size in MB of databases present in the MariaDB Server:
SELECT table_schema "database", sum(data_length + index_length)/1024/1024 "size in MB" FROM information_schema.TABLES GROUP BY table_schema;
Output:
C:\WINDOWS\system32>mysql -u root -p
Enter password: ********
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 576
Server version: 10.6.5-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SELECT table_schema "database", sum(data_length + index_length)/1024/1024 "size in MB" FROM information_schema.TABLES GROUP BY table_schema;
+--------------------+--------------+
| database | size in MB |
+--------------------+--------------+
| classicmodels | 0.75000000 |
| hello | 0.43750000 |
| information_schema | 0.20312500 |
| mysql | 2.70312500 |
| performance_schema | 0.00000000 |
| sys | 0.04687500 |
| test | 253.42187500 |
+--------------------+--------------+
7 rows in set (1.001 sec)
Check the size in GB of the databases present in the MariaDB:
SELECT table_schema "database", sum(data_length + index_length)/1024/1024/1024 "Size in GB" FROM information_schema.TABLES GROUP BY table_schema;
Output:
MariaDB [(none)]> SELECT table_schema "database", sum(data_length + index_length)/1024/1024/1024 "Size in GB" FROM information_schema.TABLES GROUP BY table_schema;
+--------------------+----------------+
| database | Size in GB |
+--------------------+----------------+
| classicmodels | 0.000732421875 |
| hello | 0.000427246094 |
| information_schema | 0.000198364258 |
| mysql | 0.002639770508 |
| performance_schema | 0.000000000000 |
| sys | 0.000045776367 |
| test | 0.247482299805 |
+--------------------+----------------+
7 rows in set (0.624 sec)