Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Check and Repair a Corrupted MySQL Database Table using SSH?  (Read 1148 times)

0 Members and 1 Guest are viewing this topic.

joseletk

  • Guest
Please refer the following steps:

a)     Login to your MySQL server using Secure Shell (SSH).

b)     Enter the following command at root prompt:

Code: [Select]
mysqlcheck -r [database name]
Where, mysqlcheck is the command to check the database, -r is the command to repair the corrupted tables. Replace the [database name] with your actual database name.

Please note that MyISAM is a default storage engine of MySQL, unless you change it. Mostly MyISAM is set as default engine to check and repair all the tables in the mysql database.

If the above doesn't work, then you can try the following commands via the Linux shell prompt.

Code: [Select]
myisamchk -r /var/lib/mysql/[database name]/*
Where, myisamchk is a command to check mysql database and -r is a command to repair the corrupted tables.

===========================================================================