If you are facing the give below error message:
Table ‘jos151_session’ is marked as crashed and should be repaired
Then this means that your mysql service was terminated when the particular table was open to write some data. After that when mysql start/restart few data present in it moves into inconsistent state.
Well it is bad news for its user but before you jump in to the pool know few safety measures. Know the most common reasons that play their important role behind the crashed MySQL table.
How long it take to repair crashed MySQL table?
This is the question of most of the users for the few KB table, it just take a few seconds; for few MB table, it take few minutes; for few GB table it take hours; for huge GB tables, it take days to weeks! It even depends on the available RAM and the processor power.
Do you got the backup of the table? It might be the better option to restore the table from the backup. Generally, user face crash issue and the best option to overcome it to use the backup. Unless the data is very important and you need it urgently run a weeklong repair process. But isn’t the weeklong repair process quite time consuming. Think about it. Always have a proper backup of your database.
What causes MySQL tables to crash?
There are varuoius reason that causes of MySQL table crashing. The first reason is behind the table crash is running out of disk space. If you got the huge amount of data in your database then ensure that you got the required disk space in advance.
Other reason behind MySQL table crashes are issuers with the operating system, hardware problems, power failures, unexpected termination of MySQL server, data corruption due to external programs.
Resolution: Repair Crashed MySQL Table
To repair the corrupted tables follow the given steps:
There are two ways to repair the crashed table if you are using InnoDB then restore the table from backup and the common reason for InnoDB tables crash is due lack of disk space which you can fix on your own.
Repairing table using MySQL console
If got the shell access then connect to MySQL server and perfrom the following steps:
>repair table my_crashed_table;
This step is recommended to repair crashed tables from few KBs to few GBs, which depend on the RAM and processor power.
Repair table using PHPMyAdmin
Rememeber: if you haven’t got the shell access then only use this method. Usually this step is recommended for small size tables only, few KB to few MBs. And anything more than that will only be a waste of time and you’ll end up frustrated. Perform the following steps:
Log on PHPMyAdmin > choose affected database > choose affected table from right pane > from With selected menu, choose “Repair table”.
The crashed table will be repaired in short span of time, if the table size is a few KBs to a few MBS, and engine is MyISAM.
If the above steps fails to repair the table then the last option left with you is to go with the third party tool. MySQL Repair Tool is an amazing tool, which help you repair corrupted, damaged or inaccessible data. It can recovers data and tables structure in a healthy form. With the help of this software there is no chance of losing your important data. It supports every version of MySQL, which is easily accessible by all the present platforms that contain Windows OS.
- Backup Backup Backup your database.
- Plan your design be keeping future in mind.
- If you are on shared hosting don’t try to repair 700 GB table.
Steps to repair crashed MySQL table
Step 1: Start with Stellar Phoenix Database Repair for MySQL . Software and you can see the main interface as shown below.
Step 2: Click on ‘Select’ button & then select ‘Repair corrupt database which is stored at default location of MySQL’ option to select your database from default location and then click.
Step 3: The left pane shows the preview of database and its component in a tree like structure after completing scanning process.
Step 4: After previewing your database, to start repair process click ‘Repair’ button in file menu on the main user interface. Stellar Phoenix Database Repair for MySQL dialog box appears. Click Yes.
Step 5: After successful completion of the process, a message box is displayed as ‘repair process finished successfully’. Click ‘OK’ to close the message box.
Step 6: If you want to select the database manually then select ‘Manual selection of database to repair’ option & then click browse. Browse the folder dialog box opens. Select the folder that contains database and click ‘OK’.