Repair Damage or Corrupted Table in MySQL
Here few standard MySQL command How To Repair Database Table in MySQL :
There are 2 method how to repair database in MySQL
First, we can just login into MySQL server and repair table there
Second, we can use MyISAMCHK to repair the table.
Login as root into your server
First Method is repair table from mysql console
[code]$mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32686 to server version: 5.0.27-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use testing;
mysql>mysql> repair table reviews;
+-----------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-----------------+--------+----------+----------+
| neohost.reviews | repair | status | OK |
+-----------------+--------+----------+----------+
1 row in set (0.00 sec)
mysql>[/code]
Second method is using MyISAMCHK to repair table.
IMPORTANT : IMPORTANT : IMPORTANT
We need to shutdown MySQL server first before we start repair table using MyISAMCHK.
First all we need to do is shutdown MySQL server Gracefully
[code]$/usr/local/mysql/bin/mysqladmin -u -p shutdown[/code]
Next, We will repair table using MyISAMCHK in "testing" DB
[code]$cd /var/lib/mysql/testing
$myisamchk -r cpg135_albums.MYI
- recovering (with sort) MyISAM-table 'cpg135_albums.MYI'
Data records: 3
- Fixing index 1
- Fixing index 2[/code]
We can also repair all tables in "testing" DB.
[code]$myisamchk -r *.MYI[/code]
Recent blog posts |
Recent comments
|
Comments
Post new comment