1) MySQL command – sum up the data_length + index_length is equal to the total table size.
data_length – store the real data.
index_length – store the table index.
List out all the databases size
[root@Asterisk backup]# mysql -u root -pMY_PASSWORD
mysql> SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024
-> "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
+--------------------+----------------------+
| Data Base Name | Data Base Size in MB |
+--------------------+----------------------+
| asterisk | 0.32617188 |
| asteriskcdrdb | 2.66910934 |
| information_schema | 0.00390625 |
| meetme | 0.00488281 |
| mya2billing | 0.29803276 |
| mysql | 0.52678108 |
| roundcubedb | 0.25000000 |
| vtigercrm510 | 9.49178505 |
+--------------------+----------------------+
8 rows in set (0.29 sec)
mysql>
2. Locate the MySQL data file
data_length – store the real data.
index_length – store the table index.
List out all the databases size
SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;Command login Database:
[root@Asterisk backup]# mysql -u root -pMY_PASSWORD
mysql> SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024
-> "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
+--------------------+----------------------+
| Data Base Name | Data Base Size in MB |
+--------------------+----------------------+
| asterisk | 0.32617188 |
| asteriskcdrdb | 2.66910934 |
| information_schema | 0.00390625 |
| meetme | 0.00488281 |
| mya2billing | 0.29803276 |
| mysql | 0.52678108 |
| roundcubedb | 0.25000000 |
| vtigercrm510 | 9.49178505 |
+--------------------+----------------------+
8 rows in set (0.29 sec)
mysql>
2. Locate the MySQL data file
mkyong@myserver:/var/lib/mysql$ ls -lh
total 1.5G
drwx------ 2 mysql mysql 4.0K 2009-08-26 13:36 mydatabase
-rw-r--r-- 1 root root 0 2009-08-19 09:39 debian-5.0.flag
-rw-rw---- 1 mysql mysql 1.5G 2009-08-27 17:32 ibdata1
-rw-rw---- 1 mysql mysql 5.0M 2009-08-27 17:32 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M 2009-08-27 17:32 ib_logfile1
drwxr-xr-x 2 mysql root 4.0K 2009-08-19 11:19 mysql
-rw------- 1 root root 6 2009-08-19 09:39 mysql_upgrade_info
3. Windows
No comments:
Post a Comment