Greetings
tl;dr
How can I repair a corrupted database index easily?
I run an up to date Nextcloud instance on a rented virtual machine on a slightly outdated Ubuntu installation (19.04).
For reasons currently unknown to me, this machine was down today. Once it came up again, Nextcloud was no longer working.
Trying to log on to the web interface, I was greeted by:
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please >include the technical details below in your report.
More details can be found in the server log.
nextcloud.log is filled with
General error: 2006 MySQL server has gone away
And the system logs show that mysqld crashes and gets restarted by systemd in short intervals. Apparently any time one of my users’ clients tries to access Nextcloud.
Spending some time looking around, I think the problem is a corrupt index in the nextcloud db:
root@myrentedvm:/var/lib/mysql# mysqlcheck -u root -p nextcloud
Enter password:
nextcloud.oc_accounts OK
nextcloud.oc_activity OK
nextcloud.oc_activity_mq OK
nextcloud.oc_addressbookchanges OK
nextcloud.oc_addressbooks OK
nextcloud.oc_appconfig OK
nextcloud.oc_authtoken
Warning : InnoDB: Index authtoken_last_activity_idx is marked as corrupted
error : Corrupt
nextcloud.oc_bruteforce_attempts OK
nextcloud.oc_calendar_invitations OK
nextcloud.oc_calendar_reminders OK
nextcloud.oc_calendar_resources OK
When I encountered this the first time, a “select * from oc_authtoken;” crashed the mysql process. After a single run of “mysqlrepair”, I can run a select on table oc_authtoken and get the data stored.
Is it possible that the corrupted index prevents Nextcloud from working and how can I repair it easily?