How to optimize & repair your MySQL database Print

  • 0

Overview

Over time, databases become fragmented and grow in size. Optimizing and repairing tables helps keep your website fast and stable.

Option 1 — Optimize using phpMyAdmin

  1. Open phpMyAdmin
  2. Select your database
  3. Scroll to the bottom and click Check All
  4. Select:
    Optimize table

Option 2 — Repair corrupted tables

If you see errors like “table is marked as crashed”, run this:

  1. In phpMyAdmin, select your database
  2. Check the broken tables
  3. Select:
    Repair table

Option 3 — Optimize via SQL command

OPTIMIZE TABLE wp_posts;
OPTIMIZE TABLE wp_options;
OPTIMIZE TABLE wp_postmeta;

Option 4 — CLI Optimization (SSH)

mysqlcheck -o --user=username_dbuser -p username_dbname

Performance tips

  • Clean up post revisions (WordPress)
  • Clear WooCommerce sessions
  • Delete old plugins/tables
  • Enable object caching

Was this answer helpful?

« Back