How to Check and repair a corrupted MySQL database on CentOS server using SSH ?

How to Check and repair a corrupted MySQL database on CentOS server using SSH ?

Today, we will learn to check & repair MySQL database table through SSH. Normally we use PhpMyAdmin to manage our MySQL databases.

1. First of all, you have to log in as root using SSH.

2. Now, you have to run this command to check the desired database.
# mysqlcheck -r [your-database-name]
Here, mysqlcheck command will check the database.
-r will repair the corrupted tables of the database.

3.If the above command does not work in any case then you can use myisamchk command:
# myisamchk -r /var/lib/mysql/[your-database-name]/*
Here, you should keep this thing in mind that MyISAM is the default storage engine for MySQL.
myisamchk command will check the database.
-r will repair the corrupted tables of the database.
Author
bhawanisingh
Views
4,581
First release
Last update
Rating
0.00 star(s) 0 ratings
Top