---
title: "Check and Repair Database with WP-CLI"
description: "When a WordPress website shows an Error establishing a database connection, those with access to cPanel can check and repair databases using MySQL Database or phpMyAdmin. Below, we cover how web..."
url: https://www.inmotionhosting.com/support/edu/wordpress/wp-cli/check-and-repair-database-with-wp-cli/
date: 2019-05-29
modified: 2021-08-16
author: "InMotion Hosting Contributor"
categories: ["WP-CLI"]
type: post
lang: en
---

# Check and Repair Database with WP-CLI

When a WordPress website shows an *Error establishing a database connection*, those with access to cPanel can check and repair databases using **[MySQL Database](/support/website/check-and-repair-databases-in-cpanel/)** or **[phpMyAdmin](/support/website/check-repair-database/)**. Below, we cover how web developers can **check and repair a WordPress database using WP-CLI**.

**Note:** You must navigate to the root folder of your WordPress installation in [SSH](/support/server/ssh/do-you-provide-ssh-access/) or cPanel [Terminal](/support/edu/cpanel/how-to-launch-the-cpanel-terminal/) to continue.

## Check Database

Type the wp db check [WP-CLI command](https://developer.wordpress.org/cli/commands/db/check/). You’ll see results listing each table, then *OK* or
*note : The storage engine for the table doesn’t support repair*.

| cpuser01_bgri000.wpa0_terms | OK |
| --- | --- |
| cpuser01_bgri000.wpa0_usermeta | OK |
| cpuser01_bgri000.wpa0_users | OK |
| **Success:** Database checked. | |

## Repair Database

Type the wp db repair [WP-CLI command](https://developer.wordpress.org/cli/commands/db/repair/). You’ll see results listing each table, then *OK* or
*note : The storage engine for the table doesn’t support repair*.

| cpuser01_bgri000.wpa0_terms | OK |
| --- | --- |
| cpuser01_bgri000.wpa0_usermeta | OK |
| cpuser01_bgri000.wpa0_users | OK |
| **Success:** Database repaired. | |

If this doesn’t fix your issue, even after [clearing your browser](/support/website/how-to-clear-browser-cache-for-major-browsers/) and [server cache](/support/website/cache-manager-cpanel/), please contact our [Live Support](/support/amp/how-to-get-great-technical-support/) for further assistance.

Learn more about [WP-CLI](https://www.inmotionhosting.com/support/edu/wordpress/wp-cli/), the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows!
