How to Repair MySQL Databases in Control Web Panel (CWP)

Check and Repair MySQL Databases in Control Web Panel

As flexible as dynamically generated sites are, they aren’t without potential issues. There’s bound to be an instance of database corruption at some point between web server requests and complex PHP executions. This is why it is important to know how to repair MySQL databases on your Control Web Panel (CWP) server. We’ll also cover how to check MySQL databases beforehand to identify what tables need to be repaired.

Repair MySQL Databases in CWP

For users with access to the CWP dashboard, you can repair MySQL databases in less than a minute by clicking a few buttons.

  1. Log into CWP.
  2. Admin users: search for and select MySQL Manager from the sidebar.
    End users: select Databases on left, then MySQL Manager.
    CWP MySQL databases
  3. In the “Database name” column, each database has buttons to optimize, check, repair, and backup the database. Select the “Check database” (second) button.
  4. A notification will show in the corner stating “Your database was Checked successfully.” A pop-up window will show which tables were affected. Take note of any tables not marked “OK” on the right before selecting Accept to close the window.
  5. Select the “Repair database” (third) button.
  6. A notification will show in the corner stating “Your database was Repaired successfully.” A pop-up window will show which tables were affected. Note any tables not marked “OK” on the right and select Accept to close the window.

phpMyAdmin

phpMyAdmin is a popular graphical database manager installed on CWP servers. In the case that you need to repair MySQL databases and make other changes, you can do so in the same place.

  1. Admin users: search for and select phpMyAdmin from the sidebar.
    End users: select Databases on left, then phpMyAdmin.
  2. Click on the database you wish to repair in the left-hand menu.
  3. The right side will update to list all tables in that database. At the bottom, select Check all to select all tables.
  4. Select the With selected drop-down menu and Check table.
  5. The page will refresh and provide a summary of tables that may be corrupted. Note any tables that show errors for further troubleshooting. Select Structure at the top.
  6. Select Check all again to include all tables.
  7. In the With selected menu, this time select Repair table.

MySQL Command-Line Interface

Sysadmins working in the command-line interface (CLI) with root access can use MySQL CLI to repair MySQL databases.

mysqlcheck --repair -u [USERNAME] -p [DATABASE]

MySQL Database Repair Tools

Simpler website builders like SitePad don’t commonly suffer from database issues and, therefore, do not have features to resolve such issues. On the other hand, PHP-based web applications commonly used for large, multi-purpose websites generally have one or two recommended methods for how to fix MySQL issues.

Repair WordPress Databases

WordPress developers know they have a db corruption case when their domain only shows a blank page stating “Error Establishing a Database Connection.” Luckily, there are a few ways to resolve this without CWP or installing plugins, meaning website owners can maintain their site without elevated system privileges.

The first method is to modify your wp-config.php file so that WordPress automatically repairs the database when problems arise. 

  1. Open CWP Terminal or log into SSH.
  2. Navigate to the root folder of your WordPress installation.
  3. Edit your wp-config.php file:
    nano wp-config.php
  4. Add this short code block in the WordPress configuration file:
    define (‘WP_ALLOW_REPAIR’, ‘true’);
  5. Save changes.
WordPress WP-CLI Database Check and Repair

The second method requires having WP-CLI installed on your web server. Instead of editing your wp-config.php file, simply run these two commands together to check and repair a WordPress database:

wp db check && wp db repair

Repair Drupal Databases

Drupal users can install OptimizeDB, a module that optimizes, checks, and repairs MySQL and PgSQL databases.

  1. Install the Drupal module using the download link for your Drupal version.
  2. Click Enable newly added modules.
  3. Under “Development,” check the box for Database Optimization.
  4. At the bottom, select Install.
  5. At the top, select Configuration.
  6. Under “Development,” select Database Optimization.
  7. Select the List of tables in the database tab.
  8. Select the checkbox at the top to select all tables. Then, select Repair tables.
    Drupal tables in OptimizeDB module

Repair Joomla Databases

Joomla 4 includes a straightforward function in the backend for learning of database issues.

  1. Log into Joomla 4.
  2. Select System on the left.
  3. Under “Maintenance,” select Database.
  4. If Joomla hasn’t detected any problems, you’ll see “No problems” in a green box.
    Joomla 4 database maintenance options

    Any issues will be listed at the top for you to handle.

Learn about how to manage your CWP or CWPpro server.

With our Cloud VPS plans, you can deploy a lightning-fast, reliable cloud platform with built-in redundancy – ensuring the availability of your environment!

Comments

It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!

Was this article helpful? Let us know!