Repairing MySQL database when the table gets crashed – Error 145

The MyISAM database engine is the default database 
engine for MySQL database. It provides a variety ofResolution:
indexing and field management functions. Its ability toTo resolve the problem and extract the database
swiftly perform the read operations on the databasesafter appearance of the aforementioned error
is one of the biggest reasons of MySQL being somessage, you can perform the following methods:
popular as a backend for Web applications. However,Make a copy of the database.
sometimes the MyISAM database tables do getStop the mysqld server.
corrupt because of several reasons. These reasonsRun the myisamchk -r -q <table_name> to repair
could be power surges, virus infections, abrupt systemthe index file without affecting the file. It is used to
shutdown when the database is open, etc. In suchperform quick recovery of the database.
cases, you should look to employ certain correctiveIf the previous step fails, then try the myisamchk
measures to recover MySQL database. However, if--safe-recover <table_name> command. It is used
you are unable to do so then you should use ato perform a detailed scan and repair of the database.
third-party MySQL database recovery tool to do theIf the previous step fails, then you should create a
needful.blank data and index files by using the following
 commands:shell> mysql db_namemysql> SET
 autocommit=1;mysql> TRUNCATE TABLE
Consider a scenario wherein you encounter thetbl_name;mysql> quit
following error message while working on a MySQLCopy the old data file in the new one. This should
database table:resolve the issue.
  
"MySQL error code 145 = Table was marked asThese methods will be able to solve the problem.
crashed and should be repaired"However, if you are unable to resolve the issue then
 you should use a third-party MySQL database repair
Cause:tool to recover MySQL database. Such read-only tools
The most possible cause of this error message is thatare non-destructive in nature and do not overwrite the
the database has corrupted due to not having enoughoriginal data while scanning the corrupted database.
space for the database.