404 Tech Support

phpBB: “Table is marked as crashed and should be repaired”

I visited my forum this morning and was getting a peculiar error:

General Error

SQL Error [ mysql4 ]

Table ‘phpbb_sessions’ is marked as crashed and should be repaired [1194]

It then goes on to describe the SQL query that it tried to run and shows some of the function calls that led up to the error.

Fortunately, this is a fairly easy error to resolve. What do you do when something is broken? You repair it! The error message even tells you that it should be repaired. From the error message, you should note the name of the table that has the problem.

In my instance, and from the screenshot below, you can see it was the ‘sessions’ table with the prefix ‘phpbb_’.

If your hosting company has phpMyAdmin installed, you can take care of this problem yourself. If you just have access to run the SQL command, say through another php page, you can use the query: REPAIR TABLE ‘phpbb_sessions’ (or whatever your problem table is).

Open up phpMyAdmin and select the database for your forum. In the left column, click on the link for the table that was listed in the error. Then when the next page reloads, click on the Operations tab on the top of the far-right.

On the page that loads for the Operations tab, scroll down until you see the Table maintenance section. There click the link for ‘Repair table’.

This will run the query to repair the table. Another page will load and show you the query that was run and any information that resulted from the query. For example, my table changed from 157 rows to 155.

That should take care of the problem. It’s hard to say what caused the table to become crashed, so you may note the time and try to track down the cause if you see an increasing frequency of the problem. As part of routine maintenance, you can also go back under the operations table and run the Optimize table query to improve performance.