Monday, October 5, 2009

Drupal unable to login due to crashed MYSQL table

For no apparent reason, our Drupal site refused to allow a regular login. The site itself seems to be working fine - but attempts to login into administration simply do not work and are redirected to the homepage.

(caveat: perhaps I've managed to hide some status/error messages being displayed in the process as I've changed quite a few things when it comes to the template files used).

Either way, I've ended-up looking in the watchdog table where I noticed the following most recent entries all the way at the bottom:
Table '.\database-name\sessions' is marked as crashed and should be repaired
query: INSERT INTO sessions
(sid, uid, cache, hostname, session, timestamp)
VALUES (....)
Seems like MYSQL table sessions is marked as crashed! Kind of makes sense why we're not able to login - new sessions are probably not being created due to the table crash.

Google quickly points to the REPAIR TABLE syntax for MYSQL which luckily runs without issues and we're back online being able to login again!

If that did not work? Probably delete and re-create the sessions table I guess.

No comments: