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

n 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.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How can I monitor what my MySQL server is doing?

A handy little Linux application called mytop fits this just perfectly. This is a near-time...

How do I backup MySQL in Linux?

1. Copying from the mysql directoryBy default, MySQL databases on servers that use Linux are...

How to install Mysql

How to install Mysql Via RPM : Please check the following link and get RPM...

How to reset a mySQL password?

If you have lost your root user password for MySQL, you can reset it with the following...

Mysql Basic Commands

[mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. create...

Powered by WHMCompleteSolution