Optimize Multiple MySQL Databases and Tables Automatically

Wrench and Screwdriver on Keyboard

I’ve always been diligent about optimizing my clients’ MySQL database tables on a regular basis to reduce storage space and improve input/output efficiency. When I first started out, MyISAM was the database storage engine standard for MySQL, and  I used to do the table optimization manually, then phpMyAdmin came along and I began using its user interface, but that quickly became impractical as my client base grew. Some of my clients have multiple databases and each of those had multiple tables. I needed an automated solution. I came up with one using a combination of cron and PHP that has worked well for me for years. I had a client ask about the script I use, and I’ve decided to share it here.

Continue reading “Optimize Multiple MySQL Databases and Tables Automatically”