• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to check database and table size in MariaDB

1152

To check database and table size in MariaDB

MariaDB is a community developed fork of MySQL. It is designed to maintain high compatibility with MySQL. It includes the XtraDB feature for replacing the innoDB. In this tutorial we are going cover the topic on how to check database size and table size in Mariadb.

Checking the database and table size

To check the various database and table size in MariaDB check whether the MySQL is running or not. enter the mysql command to call the MariaDB.

[root@linuxhelp1 ~]# mysql
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 8
Server version: 5.5.52-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.
MariaDB [(none)]> 

After invoking the MariaDB in the terminal, enter the following command to check a particular database size.

MariaDB [(none)]>  SELECT table_schema " Database Name" , SUM( data_length + index_length)/1024/1024 " Database Size (MB)"  FROM information_schema.TABLES where table_schema = ' mysql'  
+---------------+--------------------+
| Database Name | Database Size (MB) |
+---------------+--------------------+
| mysql         |         0.62618065 |
+---------------+--------------------+
1 row in set (0.00 sec)

To check the size of all the database stored in MariaDB, enter the following command to check the size.

MariaDB [(none)]>  SELECT table_schema " Database Name" , SUM(data_length+index_length)/1024/1024 " Database Size (MB)"   FROM information_schema.TABLES GROUP BY table_schema 
+--------------------+--------------------+
| Database Name      | Database Size (MB) |
+--------------------+--------------------+
| information_schema |         0.07031250 |
| mysql              |         0.62618065 |
| performance_schema |         0.00000000 |
+--------------------+--------------------+
3 rows in set (0.01 sec)

After checking a particular database size, now you can check the particular table size from the database by entering the following command.

MariaDB [(none)]>  SELECT table_name " Table Name" , table_rows " Rows Count" , round(((data_length + index_length)/1024/1024),2) " Table Size (MB)"  FROM information_schema.TABLES WHERE table_schema = " mysql"  AND table_name =" user"  
+------------+------------+-----------------+
| Table Name | Rows Count | Table Size (MB) |
+------------+------------+-----------------+
| user       |          3 |            0.00 |
+------------+------------+-----------------+
1 row in set (0.00 sec)

To check all the table size from the databases enter the following command.

MariaDB [(none)]>  SELECT table_name " Table Name" , table_rows " Rows Count" , round(((data_length + index_length)/1024/1024),2) " Table Size (MB)"  FROM information_schema.TABLES WHERE table_schema = " mysql"  
+---------------------------+------------+-----------------+
| Table Name                | Rows Count | Table Size (MB) 
+---------------------------+------------+-----------------+
| columns_priv              |          0 |            0.00 |
| db                        |          0 |            0.01 |
| event                     |          0 |            0.00 |
| func                      |          0 |            0.00 |
| general_log               |          2 |            0.00 |
| help_category             |         39 |            0.00 |
| help_keyword              |        464 |            0.10 |
| help_relation             |       1028 |            0.03 |
| help_topic                |        508 |            0.45 |
| host                      |          0 |            0.00 |
| ndb_binlog_index          |          0 |            0.00 |

To quit from the MariaDB, enter the following command.

MariaDB [(none)]>  q
Bye

Tags:
gabriel
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the command to check mariadb version you have installed?

A

The command to check mariadb version you have installed by below command

# mysql -v

Q

How to check all the table size from the databases?

A

SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2)
"Table Size (MB)" FROM information_schema.TABLES WHERE table_schema = "mysql";

Q

How to quit from the mariadb?

A

To quit from the MariaDB, enter the following command.

MariaDB [(none)]> q

Q

What is the use of check database and table size in MariaDB?

A

MariaDB is a community developed fork of MySQL. It is designed to maintain high compatibility with MySQL. It includes the XtraDB feature for replacing the innoDB.

Q

What is the command to switch to mariadb?

A

Enter the MySQL command to call the MariaDB by following command

# mysql

Related Tutorials in How to check database and table size in MariaDB

Related Tutorials in How to check database and table size in MariaDB

How to Completely Delete MariaDB Server 10.3v on Ubuntu 19.04
How to Completely Delete MariaDB Server 10.3v on Ubuntu 19.04
Jun 11, 2019
How to check database and table size in MariaDB
How to check database and table size in MariaDB
Feb 10, 2017
How to configure MariaDB (Master-Slave) Replication in CentOS/RHEL 7
How to configure MariaDB (Master-Slave) Replication in CentOS/RHEL 7
Jun 14, 2016
How to use Automysqlbackup and Autopostgresqlbackup
How to use Automysqlbackup and Autopostgresqlbackup
Apr 30, 2016
How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6
How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6
May 29, 2019
How to Install and Configure MariaDB on Oracle Linux 8.5
How to Install and Configure MariaDB on Oracle Linux 8.5
Oct 15, 2022
How to change Mysql or MariaDB Data Directory into New location
How to change Mysql or MariaDB Data Directory into New location
Apr 15, 2017
How to install LimeSurvey in Ubuntu
How to install LimeSurvey in Ubuntu
Jul 25, 2016

Related Forums in How to check database and table size in MariaDB

Related Forums in How to check database and table size in MariaDB

MariaDB
ryan class=
E: Unable to locate package mariadb-server
Sep 18, 2017
Ubuntu
lucas class=
The repository 'https://mirrors.evowise.com/mariadb/repo/10.3/ubuntu disco Release' does not have a Release file.
May 29, 2019
MariaDB
iqbal class=
ERROR 1099 (HY000): Table website was locked with a READ lock and cannaot be updated
Oct 21, 2017
MariaDB
otwol class=
Slave_IO_Running: No while checking the status of slave
Sep 24, 2019
MariaDB
benjamin class=
Unable to start Mariadb service in opensuse leap 42.1
Sep 23, 2017
MariaDB
ethan class=
How To Completely Remove MariaDB 10.1.39v On Ubuntu 19.04
May 28, 2019
MariaDB
julian class=
How to Migrate Mysql into Mariadb
Mar 28, 2017
MariaDB
grayson class=
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MariaDB server
Mar 5, 2021
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Gibbson ?
How do i run both nginx and apache in same instance on centos

Hi...,

my server is based centos operating system and my webserver is already running on Apache.... i need to run both apache and nginx on same instance ... please help me to implement this concept...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.