You can optimize and repair your MySQL tables via phpMyAdmin when encountering issues with your website or database. This process helps fix certain errors and improves the database's performance.
Here is the step-by-step procedure to achieve this :
- Access phpMyAdmin from Plesk :
- Log in to your Plesk administration panel.
- In the left-hand menu, click Databases.
- Locate the relevant database in the list and click the phpMyAdmin link or icon associated with that database. phpMyAdmin will open directly in a new tab without requiring you to log in again.
- Select the tables to process
- Once inside phpMyAdmin, you land by default on your database's "Structure" tab, which displays the list of all your tables.
- Scroll to the very bottom of the list of tables.
- Check the "Check all" box to select all the tables, or check only the specific tables that are causing a problem.
- Optimize tables
Optimizing a table consolidates wasted space and defragments the data (especially after numerous deletions or modifications), which improves query speed.
- In the drop-down menu located right next to "Check all" (labeled "With selected:"), click and choose "Optimize table".
- phpMyAdmin will automatically execute the OPTIMIZE TABLE SQL command for all selected tables.
- A green confirmation message will appear to indicate that the operation was successful.
- Repair the tables
If a website encounters errors such as "Table is marked as crashed and should be repaired," you must use the repair function.
- Just as in the previous step, select your tables (or the corrupted table) at the bottom of the list.
- In the "For the selection" drop-down menu, choose "Repair table".
- phpMyAdmin will execute the SQL REPAIR TABLE command.
Important note regarding storage engines:
- The "Repair Table" command works optimally by default with MyISAM tables.
- If your tables use the InnoDB engine (the modern standard), severe corruption usually requires server-level intervention. However, running a check or optimization operation is safe for InnoDB.