Table corruption is nearly always a symptom: a power loss, a disk that filled, or hardware failing. Repair the table, then find out which of those it was - otherwise it happens again next week.

MyISAM

mysqlcheck --check --auto-repair --databases shop
# or, for one table
mysql -e "REPAIR TABLE shop.sessions"

MyISAM has no crash recovery, so an unclean shutdown leaves tables marked crashed. REPAIR usually fixes them in seconds, and may drop the damaged rows.

InnoDB is different

REPAIR TABLE does not work on InnoDB and corruption there is serious - the engine normally recovers itself at startup. If InnoDB reports corruption, restoring from a backup is the safe path, not a repair attempt.
mysql -e "CHECK TABLE shop.orders"
sudo tail -100 /var/log/mysql/error.log

If the server will not start because of it

# my.cnf - TEMPORARY, to get the data out
innodb_force_recovery = 1
  1. Start at 1 and raise only if it will not start — levels above 4 can destroy data.
  2. Dump everything as soon as it startsmysqldump --all-databases > rescue.sql
  3. Remove the setting, rebuild the data directory — and import the dump.
Above innodb_force_recovery = 3 the engine is running in a degraded mode where writes can make things worse. Get the dump and get out; do not run a site on it.

Then find the cause

sudo dmesg -T | grep -iE 'i/o error|ata|nvme'
df -h
sudo smartctl -H /dev/sda

And convert away from MyISAM

SELECT table_name, engine FROM information_schema.tables
 WHERE table_schema = 'shop' AND engine <> 'InnoDB';

ALTER TABLE shop.sessions ENGINE=InnoDB;
InnoDB has crash recovery, row-level locking and real transactions. There is no good reason for a new table to be MyISAM, and converting removes this whole class of problem.