MySQL slave table crashed, how to fix it?

matyche

Beta member
Messages
1
Location
Germany
I have a corrupt MySQL slave table, it says:
table is marked as crashed and last repair failed

Of course, when i ran repair statement, it still showed: Corrupt

My purpose is to quickly restore the slave table. Since master table is good, my question is can i use one of the two options listed below:
1. Drop slave table, stop and start slave again, will replication automatically restore the slave table? (previously the replication was working fine)
2. Drop slave table, use mysqldump to dump the master table to slave table (suppose there is not much traffic at this time).

Thanks for any suggestion.
 
Personally, I'd go with the second option that you've thought of.

obviously you'll want to ensure that replication is still working after you're done.
 
Repairing a table with REPAIR TABLE or in case it doesn't work apply helpful resources with various methods, ultimate solution will help you only at severe mysql database corruption

http://www.techrepublic.com/forums/questions/sql-database-doesnt-work-right/
https://social.msdn.microsoft.com/F...ow-to-fix-my-sql-database?forum=sqldataaccess
https://www.repairtoolbox.com/mysqlrepair.html Repair Toolbox for MySQL

In most cases, a simple REPAIR without any options should work fine. An unusual case is when the .MYI is missing. Here is what would happen:
mysql> REPAIR TABLE fixtures;
+-------------------------+--------+----------+---------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-------------------------+--------+----------+---------------------------------------------+
| sports_results.fixtures | repair | error | Can't find file: 'fixtures.MYI' (errno: 2) |
+-------------------------+--------+----------+---------------------------------------------+

The repair has failed because the index file is missing or has a corrupted header. To use the definition file to repair, use the USE_FRM option, as follows:
mysql> REPAIR TABLE fixtures USE_FRM;
+-------------------------+--------+----------+------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-------------------------+--------+----------+------------------------------------+
| sports_results.fixtures | repair | warning | Number of rows changed from 0 to 2 |
| sports_results.fixtures | repair | status | OK |
+-------------------------+--------+----------+------------------------------------+
Everything has gone smoothly this time, as indicated by the OK Msg_text.
 
Back
Top Bottom