cPanel shows disk usage of MySQL databases and it counts it towards total allocated disk quota to the cPanel account. Under certain circumstances, cPanel shows inaccurate database size. In this article, we will discuss how can we resolve different MySQL database size issue in cPanel and phpMyAdmin.
Possible cause of high MySQL database size
If you are doing large number of add/delete operation on your database, it is possible that there is overhead in your MyISAM tables. You can remove it by optimizing tables. You can optimize it from phpMyAdmin. InnoDB storage engine does not have overhead but if you delete large number of data from a table having InnoDB storage engine, it requires to optimize it to reclaim the free space. You can optimize the tables using phpMyAdmin.
cPanel reports an incorrect database size
cPanel uses two methods to calculate the database size as follow:
It is recommended to use INFORMATION_SCHEMA to acquire MySQL disk usage. You can enable this option from Tweak Settings in cPanel.
If the above option is set to Off, change it to On. If this setting is disabled, cPanel will calculate the used size, similar to a “du” report on the database directory. When the setting is enabled, cPanel uses the disk space reported by MySQL information schema.
cPanel also maintains the cache of database sizes; this cache only updates every 4 hours via cron job script:
Using database directory size (similar to “du” command)
If you have disabled “Use INFORMATION_SCHEMA to acquire MySQL disk usage” option in Tweak Setting, cPanel will calculate the used size, similar to a “du” report on the database directory. Using this method, you may see inaccuracy in the disk usage total.
How to resolve inaccurate MySQL database size in cPanel
If you are seeing the inaccurate MySQL database size in cPanel, we recommend you to enable INFORMATION_SCHEMA option from Tweak setting if it is disabled.
In some cases, if this option is enabled and you are still seeing wrong usage, you can manually clear the database usage cache using the following command:
If the command ran successfully, it will produce no output. You should refresh the cPanel interface to verify that the cache has been updated.