Problem

Mysqltuner shows a warning “Run OPTIMIZE TABLE to defragment tables for better performance”

You want to optimise your MySQL database through SSH.

Cause

MySQL databases can become fragmented over time as database entries are created and deleted. Fragmentation causes MySQL queries to take longer to complete, slowing down your website.

Resolution

Optimize your MySQL database using the command below:

mysqlcheck -op -u username database_name

Replace username and database_name with your database details.