Corrupted Tables


Well-known member
Alrighty.. so I wake up today to find 2 of my forums down.

vB and XF forums.

Both showing mysql errors, I check the tables and they are ALL corrupted for both forums.

I don't know how this is possible. I assume something happened on the server side.

Does anyone know how to properly repair mysql tables.

Looks like all the XF tables show that they are corrupted. I rain the repair in phpmyadmin with no luck. But I see tutorials online on much different and deeper methods.

I thought I'd ask here since there is more knowledge for XF here.


PS: My host is running table repairs, but I thought I'd ask here in the meantime or in case they don't know whey they are doing or can't fix it themselves.


XenForo developer
Staff member
Really, there's not much that you can do beyond repair tables. If your tables are MyISAM (likely not), myisamchk can be run (while MySQL is shut down!). By default, most of XF's tables are InnoDB though. You can see a discussion of recovering from InnoDB corruption here: As you can see, it's fairly complex and would need to be done by the host. Generally, InnoDB should be more corruption resistant than MyISAM, so something catastrophic must've happened on your server...


Well-known member
Hi Brogan. My recent backup I would say is almost a month old.

My host was able to repair the vB database. But the XF is one they are having troubles with.

I will pass on that link above Mike and see if they can fix it.

I have NO idea what happened on the server side. I have access them to check the server logs and tell me, but no one has told me what went wrong. But it has to have been something on the server side.


Well-known member
Well I'm not sure what my host did. But I checked this morning after submitting a support ticket.

But both forums are corrupt free. Not sure if they used a daily backup or fixed the tables.

But things seem to be working now. Just hope the host doesn't further have more issues.


Well-known member
There is NO excuse not to backup a database regularly. On big boards, we obviously need to modify things slightly since a dump can take awhile and causes a load on the database, but on smaller ones, it is just a matter of a couple of cron entries. I use something like this for each database:

/usr/local/bin/mysqldump --opt -hlocalhost -umyusername -pmypassword db_name > /usr/home/myroot/mysql/db_name_`date +%Y%m%d_%H%M%S`.sql

(Those are backticks around the date/time string in the .sql filename.)

I run this daily for each database we have, then I bzip them immediately thereafter. I use another line to delete bzip files older than three days old, similar to this:

/usr/bin/find /usr/home/myroot/mysql -mtime +3 -type f -exec rm -fr {} \;

I am looking at doing more frequent backups, maybe three or four times per day, on some databases for clients. We have the server space, and removing files more than three days old keep the size manageable.


Well-known member
Thanks for the help everyone.

I normally used to do weekly backups. But my forums have been slow lately in activity after moving servers. So I've been a bit lazy with backing up.

One of the worst things you can do is NOT backup weekly.


Well-known member
Our host does a weekly full backup, and a nightly incremental backup. In the event of catastrophic hardware failures, they also run something they call a "shadow drive" that they can swap within moments to bring a server backup. Still, I like having my own backups to roll back to. The database, being live, needs a backup, but all of the other files on the server are mirrored on my "work" computer.