Sam - September 14, 2016

MySQL Table is marked as crashed and last (automatic?) repair failed

If you’ve been having database issues and tried using the MySQL CLI client to look around your database, you may have found this error when trying to query some of your tables:

MySQL Table 'table_name' is marked as crashed and last (automatic?) repair failed

This can be caused by a number of reasons such as a hard reset on your server, zero disk space available or your MySQL process crashing for some reason.

How to fix this (the fast way)

1. Login to your server using SSH

ssh root@example.com

2. Stop the MySQL service

You can stop the MySQL daemon/service by running the command:

service mysql stop

Find the perfect Proxy Product.

Proxyrack offers a multiple options to suit most use cases, if you are unsure our 3 Day Trial allows you to test them all.
Security

Residential proxies

Never get blocked, choose your location
View all option available
Vault

Datacenter proxies

Super fast and reliable
View all option available
Try

3 Day Trial

Test all products to find the best fit
View all option available

Change directory to your MySQL database

Your MySQL directory is usually located in /var/lib/mysql

cd /var/lib/mysql/YOUR_DATABASE_NAME

Run myisamchk

Then simply run the myisamchk command by executing:

myisamchk -r table_name

Replacing table_name with your actual MySQL table name

Output:

root@example:/var/lib/mysql/database_name# myisamchk -r table_name

- recovering (with sort) MyISAM-table 'table_name'
Data records: 0
- Fixing index 1
Found block that points outside data file at 1694719836
Data records: 5965594

Start the MySQL service again

service mysql start

Finished!

Your MySQL table should now be working again, at least in my case this fixed the problem.

Find the perfect Proxy Product.

Proxyrack offers a multiple options to suit most use cases, if you are unsure our 3 Day Trial allows you to test them all.
Security

Residential proxies

Never get blocked, choose your location
View all option available
Vault

Datacenter proxies

Super fast and reliable
View all option available
Try

3 Day Trial

Test all products to find the best fit
View all option available

Get Started by signing up for a Proxy Product