How do I repair a mysql database table via ssh command line?

In order to repair your mysql table in question via the ssh command line terminal, you will need to connect to your dedicated or vps server as the "root" master user in order to process this command.

 

If you are logged into the server via ssh now, here is the command you will want to enter via the command prompt. First, you will need to start the mysql command line client with this command:

 

mysql

 

After you enter this, you will see a prompt similiar to below:

 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: x.x.xx-community MySQL Community Server (GPL)

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql>

 

Once you are at a MySQL commad prompt now, you will need to select the database for which you want to repair the table on. For example:

 

mysql> USE cpanelusername_databasename;

Database changed

 

You are now actively using "cpanelusername_databasename" replace those variables to match the cpanel username and database name you are wanting to repair.

 

Now you can issue the repair operation. Here is the command:

 

mysql> REPAIR TABLE `table1` , `table2`; 

 

If you want to repair more than 2 tables, you would just add them in the order with a comma "," then put the table name(s) in single quotes.

 

 
reviewed: 10/24/2016

  • Email, SSL
  • 9 Users Found This Useful
Was this answer helpful?

Related Articles

How do I find my root password?

1) Log into your billing account: https://portal.my-tss.com/clientarea.php 2) Click on the...

How to generate a CSR in WHM

You would like to purchase or transfer an SSL certificate but need a CSR to do so. Here's how to...

Changing ip addresses

To move an account from one ip to another in WHM:1) Log into WHM using root login details....

-DELETE How to downgrade MySQL from Version 5 to Version 4

If you've upgraded your MySQL Software to the newest version but for whatever reason need to...

How to disable Recursive DNS Lookups

A very common PCI Issue is related to the DNS servers.  In order to be PCI Compliant you must...