When you get the error
Table matomo_log_visit is marked as crashed and last (automatic?) repair failed. or
ERROR 1034 (HY000): Incorrect key file for table 'piwik_log_visit'; try to repair it it means that the Mysql tables got partially corrupted and must be repaired. This problem may occur for various reasons (such as missing space on the disk) but it should occur very rarely.
It is possible to solve this problem by connecting to your MySQL server and executing the following queries:
REPAIR TABLE matomo_log_visit;
matomo_log_visit with the name of your crashed table as it appears in the error message)
This may not work, in which case use the following solution:
myisamchk -r -v -f ./your_table_repair
Your tables should now be repaired and Matomo database up and running!