When you get the error
Table piwik_log_visit is marked as crashed and last (automatic?) repair failed. it means that the Mysql tables got partially corrupt 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 piwik_log_visit;
piwik_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:
cd /var/lib/mysql/your_piwik_database myisamchk -r -v -f ./your_table_repair
Your tables should now be repaired and Matomo (Piwik) up and running!