Everyone who has been involved with IT for more than a few months has at least heard of MySQL. The acquisition of MySQL AB by Sun Microsystems brought a great deal of additional attention to MySQL’s database management system (DBMS). Even so, there is often more to MySQL than many people realize.
Unix-based servers with MySQL installations represent the majority of current installations of MySQL Server. Unlike Windows, Unix-based servers come in a number of packaging formats and configurations.
Suggested Read: Handy MySQL Commands – Cheatsheet 2018
And it is often required to get the size of a database in MYSQL via command line if you are using UNIX based OS.
By just a single SQL Query, you can easily get the information about the required databases from information_schema and print their size in MBs with the following command:
Command: select table_schema `Database`, Round(Sum(data_length + index_length) / 1024 / 1024, 1) `Size in MB` FROM information_schema.TABLES GROUP BY table_schema;
In case, if you want to display the DB size of a particular database, then use the following command:
Command: select table_schema `Database`, Round(Sum(data_length + index_length) / 1024 / 1024, 1) `Size in MB` FROM information_schema.TABLES WHERE table_schema = ‘drupal’;
Similarly you can also find out the size of a particular table by typing the following command:
Command: SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM information_schema.TABLES WHERE table_schema = “wp” AND table_name = “wp_users”;
You may also like:
- The Intricate Process of Designing and Developing Online Casino Slot Games
- Bella Protocol vs. Traditional Banking: A New Era of Financial Services
- How Does Spam Score Affect SEO?
- Top Email Marketing Applications for Effective Campaigns
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin
- Can Jews and Evangelical Christians Co-Exist?
- What Will Be Digital Information Technology in 2023
- Advantages Of Using Opkey SAP Testing Services