![]() To get the size of all tables from a specific database, use: # mysql -e '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_here<-" ' # mysql -e 'SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema. This uses SHOW TABLE STATUS FROM dbname, this will work for databases on. To get the exact value, remove the round() function from the command. User Panel -> MySQL Shows the current size of the database in the fourth column. To get the size of all databases on the server, use: # mysql -e 'SELECT table_schema AS "Database name", round(SUM(data_length + index_length) / 1024 / 1024,2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema ' # mysql -e 'SELECT table_schema AS "Database name", round(SUM(data_length + index_length) / 1024 / 1024,2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema ' It will show many details about your databases: From the command-line Suggested Read: Handy MySQL Commands Cheatsheet 2018 Command: select tableschema Database, Round(Sum(datalength + indexlength) / 1024 / 1024, 1) Size. Have you looked at the STATUS command too - it tells you per table how much space is ‘free’ -which is what is freed by Optimize: - MySQL :: MySQL 5.7 Reference Manual :: 13.7.5. Most web hosting control panel comes with phpMyAdmin, but you can also install it yourself on your account. The mySQL command Optimize does that- and will make the files smaller on disk. PhpMyAdmin is a powerful MySQL/MariaDB management tool. For example, in cPanel, simply navigate to MySQL® Databases section and you will see the size of your databases: From the phpMyAdmin interface If you have access to a control panel like cPanel, DirectAdmin etc, the easiest way is to check the MySQL section.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |