WordPress: Monitor the Size of the MYSQL Database

If you use WordPress or a other Blog Software with a MySQL Database over years it is useful to do some things regularly:

  • Check the Database Size weekly, that no Skript Kid has found a Backdoor and fills up the Database silent
  • Purge Database Caches with default maintenance tools of the Software
  • Dont forget to create a MySQL Dump Backup weekly with cron

To Check the Size login on mysql command prompt do:

$mysql -u dbuser -p #Enter Password

mysql > use dbwordpress

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;

System Echo a Table of all of your Databases with size!

If the size is much more bigger than last week and you haven’t changed anything you can try to cleanup the Database by for example with a upgrade.php, update.php or other commandline PHP Scripts of the PHP Kit (WordPress, Drupal..) Maintenance Tools. Often many little things are cached into the MySQL Databases. If this doesn’t help, rewind to older MySQL Dump and test again. Don’t forget to keep the old WordPress-DB and rewinded WordPress-DB MySQL Dump secure! If the Database grows again fast, login to WordPress, check comments area of the posts sites. If comments are allowed by Guests, disable them to prevent Spammers.

Impressum Datenschutz-DSGVO-GDPR

Last Update 08.10.2023 www.linuxonlinehelp.eu - Nonprofit Linux PC & Server Support since 2004 Tags: Linux Online Help, Linuxonlinehelp, Linux Support, Linux Hilfe